Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
return string from external task
lissal
I am publishing a new edition in an external script where it's named with date and time e.g. "2004-03-19_18:22:10".
Later in the workflow I need to be able to rollback to files in the previous edition and at that time there could have been other editions created since the one above so in order to find the name of the edition previous to "2004-03-19_18:22:10" I will run the command
"iwattrib -n $branch/EDITION/2004-03-19_18:22:10 prevedition"
The question is, how do I get the name of the edition I created earlier in the flow? Is it possible to return a value from the external task where it was named and created?
One solution could be to create a log file named after the WorkflowID and write/read it there, but are there any better solutions?
Regards,
Lisa
Find more posts tagged with
Comments
JonathonG
Use a job variable. You would set the job variable in the task that does the publishing and get it in the task that needs it. If your "publish" task is only run once in the workflow, you can create the variable at that point:
$job->CreateVariable(see docs on TeamSite::WFworkflow for parameters)
And then in your subsequent task you retrieve it:
$job->GetVariable(see docs again)
Of course, if you put the variable into your job spec up front (in a <variables> element under the <workflow> element), you could just use Get/Set commands on the value. This is more relevant if you've got several tasks that need to change the value of the job variable.
HTH,
Jonathon
Independent Interwoven Contractor
lissal
Many thanks Jonathon for your quick answer!!
nidiffer
II've got a problem along similar lines. I'm trying to get the vaule of a workflow variable into a perl scrip using the GetVariable function. This is what I have.
my $job = new TeamSite::WFworkflow($wfid);
my $comments = $job->GetVariable("\$iw_desc");
$iw_desc is the workflow variable
When I try to print out the value of $comments, it's blank. Any idea what is going on?
Thanks in advance
Migrateduser
The name of the workflow variable is a string, not a perl variable, so try:
my $comments = $job->GetVariable("iw_desc");
(without the dollar sign)
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
nidiffer
Good thought, but it didn't work. I'm still getting the same results without the $
Migrateduser
It was more than a good thought, it was the right thing to do. This is assuming you have a workflow variable called
iw_desc
. If you don't have one of those, you will get nothing back. Just because something is in your TAG_info section doesn't automatically make it a workflow variable. You have to call it
iw_setwfarg_iw_desc
in order to have access to it as a workflow variable in an externaltask. I know ghoti's notes reference this - not sure if the workflow guide has this in it yet. I think the 6.0 version has it.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
nidiffer
Indeed iw_desc was just referenced in the TAG_info. I wasn't aware that made a difference to the availability of the variable. I just looked up some of ghoti's posts and got the jist of iw_setwfarg_ and it now works like I expect.
Didn't mean to imply anything substandard about your idea. Thanks for the push in the right direction, much appriciated.
Migrateduser
Don't mind me...I tend to get a little jumpy. Need to get back on my meds. Happy to help.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com