Hi..
Iam working on a Workflow which submits DCRs attached to the workflow to Staging based on the value of LaunchDate item in that DCR itself. We want to call a Perl script that will go thru each DCR, parse it and get the value of LaunchDate item and set this value to the dummytask which on timeout acivates an Externaltask to submit DCRs. Basically, the <template_script> is generating the dummytask and externaltask for the DCRs.
This is working fine if the DCRs are pre-attached(the User selects some DCRs in Teamsite GUI and selects "Submit" to invoke the workflow).
In another case, where the first task in the workflow , which is a Usertask, which allows the author to attach the DCRs to the workflow and no DCRs are pre-attached. As we are generating the workflow tasks dynamically with <template_script>, we get an "Invalid timeout Value" error when a User selects this workflow.
The Code we are using in the <template_script> is:
my $LaunchDate = &get_dcr_attr($dcrPath, "Launch Date");
sub get_dcr_attr {
my ($dcr,$element_name) =
@_;
open(DCR, $dcr) or die("$! - Can't open DCR.Contact teamsite admin");
local $/=undef;
my $xml = <DCR>;
close DCR;
select STDOUT;
my $parser = TeamSite::XMLparser->new();
if (defined ($parser))
{
my $rootnode = $parser->parse($xml);
if (defined ($rootnode))
{
my $retvalue = $rootnode->value($element_name);
if (defined ($retvalue))
{
return $retvalue;
}
}
}
return 0;
}
my $dummytask_xml=<<EOS;
<dummytask name = 'Timer' start = 'f' description = 'wait to submit'>
<timeout v = "__TAG__('iw_launch_date');">
<succ v = 'SubmitToStage'/>
</timeout>
<activation>
<or>
<pred v = 'Approver_Legal'/>
</or>
</activation>
</dummytask>
<externaltask
name='SubmitToStage'
owner='$LaunchDate'
description='Please Review'>
<areavpath v='$area_vpath'/>
<successors>
<successorset description='Submit to Stage'>
<succ v='End'/>
</successorset>
</successors>
<command v="/interwoven/iw-home/bin/iwsubmit -u -w -c 'update' -i 'keyword' "$dcrPath" 'comments'"/>
<activation>
<pred v='Timer'/>
</activation>
</externaltask>
EOS
__INSERT__($dummytask_xml);
]]></template_script>
Is there any alternative way to achieve this?
Thank You.