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)
Dynamic WFTask->Callback() issues
dootndo2
Thanks to all who helped me on my previous post.
--TS6.1 SP2 Windows 2000 Server
I have a question/issue on calling Callback dynamically. I am currently using a CGITask in my workflow and can successfully postback all necessary values. In the CGI Task the code looks like this:
CGI TASK
use TeamSite::CGI_lite;
use TeamSite::WFtask;
use TeamSite::WFworkflow;
$|=1;
my($cgi) = TeamSite::CGI_lite->new();
$cgi->parse_data();
my($taskid) = $cgi->{form}{iw_taskid} || $cgi->{form}{task_id};
my($task) = TeamSite::WFtask->new($taskid);
my($wfid) = $task->GetWorkflowId();
my($callback) = $cgi->{form}{'servicePath'};
if ($callback != '')
{
$task->CallBack($callback, 'Callback to the WF');
}
-- chopped for brevity --
END CGI TASK
The form posts back correctly and the method is called. When I print out the actual command to a log file it does replace the variable with the path number.
Why can I not Callback based upon logic?
Still a newbie here. Any ideas or help would be great. This workflow has many paths and I do not want to hard code the return.
dootndo2
Find more posts tagged with
Comments
Adam Stoller
I'm not sure I understand the question.
What are the possible values of $cgi->{form}{servicePath} ?
How is your cgitask defined within the WFT?
What are you trying to do?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
dootndo2
The CGI Task has a large number of possible successors that are generated dynamically.
When the user selects the users to send the email to (email is the next task), the postback returns the successor value.
$cgi->{form}{servicePath}
will return a number. 0, 1, 2, 3, etc.
In the CGITask, the successors are defined.
<cgitask name="CGITask" start="f" owner = "me" description="" immediate="f">
<areavpath v = "__TAG__('iw_workarea');"/>
<successors>
<!-- These are generated dynamically -->
<successorset description = "0"><succ v = "Submit" /></successorset>
<successorset description = "1"><succ v = "Hold" /></successorset>
<successorset description = "2"><succ v = "EndTask" /></successorset>
<successorset description = "3"><succ v = "3_Email" /></successorset>
<successorset description = "4"><succ v = "4_Email" /></successorset>
<successorset description = "5"><succ v = "5_Email" /></successorset>
<successorset description = "6"><succ v = "6_Email" /></successorset>
<successorset description = "7"><succ v = "7_Email" /></successorset>
<successorset description = "8"><succ v = "8_Email" /></successorset>
<successorset description = "9"><succ v = "9_Email" /></successorset>
<successorset description = "10"><succ v = "10_Email" /></successorset>
<!-- End Dynamic generation -->
</successors>
<command v="test.ipl"/>
<activation><or><pred v = "previous_Email_external_task"/></or></activation>
</cgitask>
The Callback will call the successor defined here. The successors are also defined dynamically.
Hope this makes it more clear.
dootndo2
Adam Stoller
Looks like it should work - are you sure you have a valid task object? In cgitask scripts - you sometimes have to make sure that the form variable you're accessing isn't an array - doing something like:
$taskid = shift
@$taskid
if (ref($taskid) eq "ARRAY");
I guess I don't understand the problem. The dynamic list of successorsets is generated during workflow instantiation - presumably you keep track of the maximum number in a job variable which you can then access from within the cgitask script to allow it to provide an interface for accessing all those successorsets.
However - I just took a look at your first post again - and it contains the following:
if ($callback != '')
That should be:
if ($callback ne '')
Perhaps that's the root of your problem...
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
dootndo2
Fish, thanks for your prompt responses.
"are you sure you have a valid task object? "
This helped immensly. For others that review this post, I here is the solution:
use TeamSite::CGI_lite;
use TeamSite::WFtask;
use TeamSite::WFworkflow;
$|=1;
my($cgi) = TeamSite::CGI_lite->new();
$cgi->parse_data();
my($taskid) = $cgi->{form}{iw_taskid} || $cgi->{form}{task_id};
my($task) = TeamSite::WFtask->new($taskid);
my($wfid) = $task->GetWorkflowId();
my($callback) = $cgi->{form}{'servicePath'};
if ($callback != '')
{
$taskid = $cgi->{form}{'taskid'};
$task = TeamSite::WFtask->new($taskid);
$wfid = $task->GetWorkflowId();
$task->CallBack($callback, 'Finished group assignment.');
}
TS will get the task at the page level using:
my($taskid) = $cgi->{form}{iw_taskid} || $cgi->{form}{task_id};
Note that there are no quotes.
When we post back this value is destroyed (because we have to post it back). So, I got the variable from the form this way:
$taskid = $cgi->{form}{'taskid'};
The variable is retrieved on postback only (because of the if ($callback != '')
I was then able to then get the task as was previously done.
Thanks Fish! Enjoy your weekend!
dootndo2