Hi
I have an external script. The code for that script is as below:
### USE LIBRARIES AND INITIALIZE VARIABLES
use strict;
use TeamSite::WFtask;
use TeamSite::WFworkflow;
use TeamSite::Config;
use XML::XPath;
use XML::XPath::XMLParser;
my ($wfid, $taskid, $area) =
@ARGV;
my $DCR_TYPE = "TeamSite/Templating/DCR/Type";
my $job = new TeamSite::WFworkflow($wfid);
my $task = new TeamSite::WFtask($taskid);
my
@files = $task->GetFiles();
## CHECK FOR DCR ONLY and remove other files from array
my
@files1;
foreach my $file (
@files){
if($file =~ m/templatedata/g)
{
push (
@files1, $file);
}
}
@files =
@files1;
my $iw_home = TeamSite::Config::iwgethome();
my $iwmount = TeamSite::Config::iwgetmount();
$area = $iwmount . $area;
my
@dcrType = ();
my
@browseItems = ();
my ($dcrPath, $dctPath, $dcr, $dct, $ptvPath , $dcrname) = "";
my $error = "";
#### LOG ANY DEBUG COMMENTS
open(LOG, ">D:\\iw-home\\tmp\\generate_attach_assets_$wfid.log");
print LOG "***** Begin****\n";
print LOG "Job ID:$wfid\t Task ID:$taskid\n";
print LOG "WORKAREA:$area\n";
print LOG "DCR/files:$files[0]\n";
### CHECK IF FILE IS A DCR OR NOT
my $chkDCRCmd = `${iw_home}/bin/iwextattr -g $DCR_TYPE "$area\\$files[0]"`;
my $ret = $? >> 8;
##$ret =152 ; ### TEST BY IMRAN TO BREAK FOR ERROR ## KEEP COMMENTED ALL TIMES
print LOG "Error Code:$ret\n";
if($ret == 152)
{
print LOG "This is an invalid DCR or this file is not a DCR. Exiting this task.\n";
$task->CallBack(0,"Failed to generate. Invalid DCR or File");
exit 0;
}
elsif ( $chkDCRCmd eq "LINKnet/news") ###CHECK IF THE DCR IS OF TYPE LINKnet/news
{
print LOG "This is a valid DCR\n";
$dcr = $files[0];
}
else
{
print LOG "This File is not a valid LINKnet/news type dcr.\n";
$task->CallBack(0,"Failed to generate. Invalid DCR or File");
exit 0;
}
When i submit the DCR, the workflow starts and in teamsite GUI, the DCR is showing attached to the task.
Now in the above script when i call
my
@files = $task->GetFiles();
it is showing no files. The
@files is empty.
I am getting the error in the LOG: This File is not a valid LINKnet/news type dcr.
I want the DCR which is attached to th task in these script.
Please give me valuable suggestion