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)
Work Flow tasks based on the return value
s6634
Hi,
Is there any way to direct/divert flow of the work flow in the sub sequent tasks based on the value returned by the perl script in an external task.
Could any one throw light on this.
Thanks in advance
Find more posts tagged with
Comments
laj1
Yes,
the set of sucessors defined for a task are treated as array elements, and the value returned by the callback() method is used to index that array and therefore choose the successor.
Len.
Len Jaffe
My Heart Is A Flower
s6634
Hi Len,
Thanks for your reply. Could you elaborate bit pl.
Thanks,
Kumar
Migrateduser
Let's say you have 2 successors for your externaltask listed in this order in your wft file:
approve
reject
In your script, if you want to execute the first successor (approve), you would callback using this syntax (assuming you use the iwcallback CLT):
`$IWHOME/bin/iwcallback $taskid 0`;
and if you want to execute the second successor (reject), use this syntax:
`$IWHOME/bin/iwcallback $taskid 1`;
Whichever callback function you use, you still return a "return code" that maps to a successor in your list of successors. They are indexed, starting at 0, based on the order you have them listed in your task definition.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
laj1
Your workflow is defined by a big ball of XML.
An instance of a workflow is called a job.
A job is made of of tasks - usertasks, externaltasks, etc.
Lets pretend we've got a workflow that runs an external task, say OpenDeploy, and then you want to run the "ILoveItWhenAPlanComesTogether.ipl" or "Doh.ipl" external tasks to email the amin with the success or failure of the deployment.
You're going to have XML which look almost, but not quite, entirely unlike this:
<workflow name="deployAndSnitch" owner="jrandomowner" description="deploy files and tell me what happened">
<other tags that I'm not looking up today>
<externaltask name="deploy" description="deploy files">
<successors>
<successorset description="notify for success of the deployment.">
<succ v="hoorah"/>
</successorset>
<successorset description="notify for failure of the deployment.">
<succ v="doh"/>
</successorset>
</successors>
<command v="runmydeploy.ipl">
</externaltask>
<external task name="doh"> xml stuff </externaltask>
<external task name="hoorah"> xml stuff </externaltask>
</workflow>
With me so far?
Good.
Now runmydeploy.ipl is a perl script which runs the opendeploy program for us, and at the bottom returns the result status to the workflow by using the callback() method..here's an excerpt:
--------
Use teamSite::WFTask;
# get the task id from the command line and creat a Workflow task out of it
taskid = $ARGV[$foo];
$TASK = new teamSite::WFtask($taskid);
# run OD
some perl commands here
# now tell the workflow which successor to run.
if (success) {
$TASK->CallBack(0, "woohoo"); # 0 = first element in the successor array
} else {
$TASK->CallBack(1, "boohoo"); # 1 = second element in the successor array
}
and there you have it
Len Jaffe
My Heart Is A Flower
s6634
Thank you very much Dave & Len
Kumar
Adam Stoller
I believe you'll find this covered in the
Workflow Tutorial
document, along with a bunch more (one of these days I'm going to find time to update it again...)
--fish
(Interwoven Senior Technical Consultant)
Migrateduser
Wouldn't it be better if someone just took your tutorial and added that great information to the Developer's Guide instead?
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
Hazzie
I have to agree with Dave. He very kindly pointed me in the direction of this document a while back and i have found many useful things out due to it. This is very useful stuff and if it can get added to the developers documentation i am sure many more people would find it helpful.
Hazzie
TS 5.5.2 on NT.
megamala
# run OD
some perl commands here
If I run OD script **** (on solaris)
../iwodstart ****
How can know whether it success or not. How can get return value success here.
# now tell the workflow which successor to run.
if (success) {
$TASK->CallBack(0, "woohoo"); # 0 = first element in the successor array
} else {
$TASK->CallBack(1, "boohoo"); # 1 = second element in the successor array
}
Migrateduser
That all sort of depends on how you define "success". Interwoven certainly didn't make this easy for us like it was in the old OpenDeploy. The nonsense returned by the iwodstart CLT can possibly give you an idea of success if it contains the line
Status: Completed
. But sometimes you can still get that line even if there are failures in the deployment. For that you have to parse the log. That's a lot of fun. It all boils down to how granular your idea of success is. But regardless, you have to do some extra work to figure it out.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com