Hi,We need to get and set the value of a task variable from an external task. I am trying to achieve this as - my $cmd = "$iwhome/bin/iwgettaskbyname"; my $taskName = `$cmd $wfid DeployTask`;This fetches me the correct task ID for the Deploy Task.Now to access the task variable I am using - my $task = new TeamSite::WFtask($taskName); my $var1 = $task->GetVariable('filelist');$task is returning some hash value but I get nothing for $var1. Is there some other way to accomplish this?Any pointers would be of great help.
Yeah, I am already using that. Following is my IPL -#!D:\Interwoven\TeamSite/iw-perl/bin/iwperl -wuse TeamSite::WFtask;use TeamSite::WFworkflow;use TeamSite::Config;$|=1;my $logFile = "D:\\Interwoven\\TeamSite\\httpd\\iw-bin\\test\\log.txt"; open (FILE,">>".$logFile);print FILE "Hi\n";my $iwhome = TeamSite::Config::iwgethome();my $iwmount = TeamSite::Config::iwgetmount();my ($wfid, $taskid, $area) = (@ARGV[0..2]);my $workflow = new TeamSite::WFworkflow($wfid);my $cmd = "$iwhome/bin/iwgettaskbyname";my $taskName = `$cmd $wfid DeployTask3`;print FILE "$taskName\n";my $task = new TeamSite::WFtask($taskName);print FILE "$task\n";my $var1 = $task->GetVariable('filelists');print FILE "$var1\n";close FILE;1;
I have created a variable on DeployTask3 with name filelists.
#!D:\Interwoven\TeamSite/iw-perl/bin/iwperl -wuse TeamSite::WFtask;use TeamSite::WFworkflow;use TeamSite::Config;$|=1;my $logFile = "D:/Interwoven/TeamSite/httpd/iw-bin/test/log.txt"; open (FILE, ">>", $logFile) || die " '$logfile' ($!)";print FILE "Hi\n";(my $iwhome = TeamSite::Config::iwgethome()) =~ tr|\\|/|;my $iwmount = TeamSite::Config::iwgetmount();my ($wfid, $taskid, $area) = @ARGV; #=# (@ARGV[0..2]);my $workflow = TeamSite::WFworkflow->new($wfid);#=# Is there some reason you didn't use $workflow->GetTaskByName() ?my $cmd = "$iwhome/bin/iwgettaskbyname";chomp(my $taskName = qx($cmd $wfid DeployTask3));print FILE "$taskName\n";my $task = TeamSite::WFtask->new($taskName);print FILE "$task\n";my $var1 = $task->GetVariable('filelists');print FILE "$var1\n";close FILE;1;
Thanks a lot Ghoti, it worked
Yup, I got it. For capturing the output of a command, we need to use qx() function.
qx(...)
`...`
Chomp in red which removed all the trailing \ n from the string.