Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
CGI task
sachin_sharma78
Hi all,
Need help to clear my doubt about CGI task. Though I have gone through the workflow manual and sample cgi program I still couldn't discover how to pass the value of the fields from CGI program to workflow.
In my case, I have a drop down in cgi program and i need to pass the selected value (by user) to workflow in such a way so that this value can be set as workflow variable. Later on i need to pass this workflow variable to some other task in my workflow. It would be nice if somebody could provide me snippet of the code.
Find more posts tagged with
Comments
kshitiz
In the CGI task only you can set the value to some workflow variable.
The tast ID of the CGI task is passed to the CGI through a HTTP variable. You can get the taskID value through:
sub TASK_PARAM () { "taskID" }
# Get the Task information
my $taskid = $cgi->{form}{&TASK_PARAM};
my $task = new TeamSite::WFtask($taskid);
Using $task you can get the workflow id.
my $wfid = $task->GetWorkflowID();
my $wf = new TeamSite::WFworkflow($wfid);
$wf->setVariable($name,$value);
I think this should do the trick.
Kshitiz Sharma
BT Wholesale | CMS
Mahindra British Telecom
Adam Stoller
sub TASK_PARAM () { "taskID" }
# Get the Task information
my $taskid = $cgi->{form}{&TASK_PARAM};
my $task = new TeamSite::WFtask($taskid);
Why the use of
TASK_PARAM
? also I don't believe that
"taskID"
is the correct value.
Actually, the code is more robust if you do something like:
use TeamSite::CGI_lite;
my $cgi = TeamSite::CGI_lite->new();
my $taskid = $cgi->{form}{iw_taskid}
|| $cgi->{form}{task_id}
;
#=# (1)
$taskid = shift(
@$taskid)
if (ref($taskid) eq "ARRAY");
#=# (2)
my $task = new TeamSite::WFtask($taskid);
die "Something went wrong [$taskid] if (!$task->IsValid());
#=# (3)
my $job = new TeamSite::WFworkflow($task->GetWorkflowId());
#=# (4)
...
$job->setVariable($varname, $varvalue);
#=# (5)
...
Notes:
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
sachin_sharma78
Thanks a lot Adam and Kshitij. Its working now.