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)
Workflow Variables Disappear?
Ankur979
We are using TeamSite Templating 5.0.2 on Solaris. We have a workflow where we declare our own workflow variables and a cgi task is the first task of the workflow. This cgi task calls a custom CGI script. In this CGI, we use the TeamSite::WFworkflow Get Variable() function to retrieve these workflow variables, which then get processed and carried through to another CGI, as hidden variables. This normally works fine.
It is when we were doing some error checking that I noticed something different. As a test, I closed one of the CGI windows and wanted to go back to the To Do List. From there, I did a 'Start Task' from the Task Options drop-down menu for that job to restart the same CGI. The first CGI window came up as expected, however, it did not have any of the workflow variables I was using. This happens for the other CGIs in the sequence also.
To debug, I selected the 'Job Attributes' from the Job Options drop-down menu. After the test, I see all the workflow variables listed there.
Find more posts tagged with
Comments
Adam Stoller
You appear to have uncovered a bug - which I will file shortly - the problem seems to be that the 'id' of the current workflow object is not being found, and without that 'id' it isn't able to retrieve the value of the variable (though the variable is still there).
If you can tell me what company you work for (and/or for which company you are consulting for?) - I will add that information to the bug report when I get it filed.
--fish
(Interwoven, Curriculum Development)
Ankur979
please send me your interwoven email and i will send you my information, thanks.
Adam Stoller
My mistake - I believe this is a case of programming / "user" error - and not a bug in the system. At least that was the source of my being able to reproduce the problem in my environment.
I'll explain what I did - and what the fix for what I did was - your situation is probably similar - I'll include psuedo line numbers for refrencing after the code snippet
-------[highly abrdiged code]------------------------------
[1] use CGI_lite;
[2] $cgi = TeamSite::CGI_lite->new();
[3] $cgi->parse_data();
[4] my($taskid) = $cgi->{form}{'iw_taskid'};
[5] $taskid = $taskid[0] if (ref($taskid) eq "ARRAY");
[6] my($task) = TeamSite::WFtask->new($taskid);
[7] my($job) = TeamSite::WFworkflow->new($task->GetWorkflowId());
[8] my $val = $job->GetVariable("Key1");
---------------------------------
With the above code - '$val' comes back as "Value1" when the cgitask script is run "immediately" - but comes back as "" if started manually from the To Do List. Line '5' is the reason.
You might not even have anything like line 5 - you might just have assumed that line 4 is sufficient, well unfortunately it isn't.
Each time the script is accessed from the To Do list - form data is essentially re-posted (my term, not necessarily technically correct) - and as such, what used to be a single scalar form variable is now, in fact, a list of form variables (all identical, but a list none the less).
When I quickly tried to reproduce your situation - I already knew that - but I mis-coded line 5. Instead of:
$taskid = $taskid[0] if (ref($taskid) eq "ARRAY");
it should have been:
$taskid = $$taskid[0] if (ref($taskid) eq "ARRAY");
or
$taskid = $$taskid[0] if (ref($taskid));
The key part being that I left out one very important '$' ($$taskid[0] not $taskid[0]) - and as a result of doing this, $taskid becomes '0' and the task object derived from it is invalid and everything beyond that is essentially garbage.
Can you verify whether or not you have something like my original line 5 -- or no such line -- in your code?
If so - try agumenting your code as described above and please verify whether or not that fixes the problem.
--fish
(Interwoven, Curriculum Development)
1.jpg
2.jpg
Migrateduser
You could also use the syntax:
$taskid = $taskid->[0] if (ref($taskid));
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
Ankur979
works like a charm. thank you very much!!
3.jpg
4.jpg