I am facing the below specified problem, as I am parsing the DCR while initiating workflow.
Can any one quickly tell me the resolution to this issue as the KB give no light on how to overcome this one.
WorkFlow Template Instantiator Executes Statements Twice
Knowledge Base Article: 51470
Type: Tech Note
Synopsis
This article explains why system calls and statements put into the WFT, get executed twice.
Details
my code as follows:
<template_script><![CDATA[
######################################################################
# Initializing the workflow
######################################################################
debug("sandeep");
my $dcrPath=$iw_workarea."/".__VALUE__('iw_file');
my $Content_Relevance=Bharti::Attach::getDCR($dcrPath,$iw_workarea);
my $Content_Relevance=Bharti::Attach::getContentType($dcrPath);
#my
@reviewerdata=Bharti::Attach::getReviewer($iw_workarea);
#my $Content_Primary_Approver=$reviewerdata[1];
#my $Content_Primary_Approver_Email=$reviewerdata[2];
#my $Content_Secondary_Approver=$reviewerdata[3];
#my $Content_Secondary_Approver_Email=$reviewerdata[4];
#=====================================================================
# simple debugging routine
#=====================================================================
sub debug {
if ($debug_mode eq "1") {
if ($debug_output) {
print STDERR
@_;
if (-e ($debug_output)) {
# Just return if it fails to open debug file
open(OUT, ">>$debug_output") || return;
print OUT
@_, "\n";
close(OUT);
} else {
# Just return if it fails to open debug file
open(OUT, ">>$debug_output") || return;
print OUT "File Created and Permission Set to 777\n";
print OUT
@_, "\n";
close(OUT);
`/usr/bin/chmod 777 $debug_output`;
}
}
}
}
######################################################################
# End of Initialisation
######################################################################
]]></template_script>
The WFT instantiator evaluates the WFT once to see if it has all of the data it needs to instantiate a new job, which means that any Perl code within a <template_script> blockwill be executed.
If the WFT instantiator needs more user input, then it evaluates the WFT a second time, to render the HTML form. Then, any Perl code within a <template_script> block will be executed, again.
Regards,
Sandeep Madan