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)
template script
jameszwang
Hi,
I have a question in regards to when the code within <template_script> tags is compiled and executed. I have confirmed that it gets executed when the workflow starts up, but does it get executed again when the job instance reaches tasks where <template_script> tags are found in the WFT file?
I want to have the script automatically assign ownership of a group task to a user. So i've embedded code in the grouptask to take ownership of the task. It is shown below:
<grouptask lock = "t"
name = "PreviewContent"
start = "f"
immediate = "t"
description = "">
<areavpath v="__TAG__('iw_workarea');" />
<successors>
<successorset description = "Complete task">
<succ v = "ApproveContent"/>
</successorset>
</successors>
<sharedby>
<user v="__INSERT__('xxxxxx');" />
<template_script><![CDATA[
if($current_role eq 'CC')
{
__INSERT__("<user v='$iw_owner'/>");
my $cmd = "iwtaketask $iw_task_id $iw_owner";
`$cmd`;
}
]]></template_script>
</sharedby>
<timeout v="__INSERT__($timeout_value);">
<succ v = "AddDCR" />
</timeout>
<activation>
<or>
<pred v = "ActivatePreviewContent"/>
</or>
</activation>
</grouptask>
my concern is if the script only gets executed once during startup, then the command 'iwtaketask' will not have the proper task id to do what it is suppose to do. Is this even the right approach to automatically take ownership of a task? TeamSite version is 6.5. Thanks so much for your help in advance!
Find more posts tagged with
Comments
james1
WFT code executes prior to instantiating (or, compiling) the job. "iwtaketask" and most other workflow-related CLTs operate on jobs and tasks -- meaning that the job has already been compiled. Prior to that, the job and task objects do not exist in the server, and so, as you point out, there is no job/task ID to provide to the CLTs.
If you really want to automatically assign a grouptask to a user at job instantiation time, then perhaps you could start your job off with an external task that calls iwtaketask on your grouptask, and then proceeds on to the rest of your workflow.
Hope this helps.
-- James
--
James H Koh
Interwoven Engineering