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)
successors based on users choice
peri
Hi All,
Our workflow requires setting successors based on user input at the time of author submit. If they choose QA review, then after editor approval successor is set to QA otherwise, it goes to submit and deploy. However, when I put the following code, I am getting errors saying that successor set is not properly defined.
Here is the code snippet: Looks like the IF condition is not working properly. Any pointers at what I am doing wrong is greatly appreciated.
Thanks,
Murthy
TAG_info(
QA=>
[ html => "<input type='checkbox' > value='true' ",
is_required => 'false',
label => "QA Approval Required ?",
],
);
<usertask name="Editor_Review"
owner="__TAG__('iw_areaowner');"
description="Editor Review"
lock="f"
start="f"
readonly="t">
__INSERT__("<areavpath v='$area_vpath'/>");
<successors>
<template_script><![CDATA[
if (__VALUE__('QA') == 'true')
{
__INSERT__("<successorset description='Approve'><succ v='QA_Review' /></successorset>\n\t");
}
else
{
__INSERT__("<successorset description='Approve'><succ v='Submit' /></successorset>\n\t");
}
]]></template_script>
<successorset description="Reject">
<succ v="Submit"/>
</successorset>
</successors>
<activation>
<or>
<pred v="Metadata_Capture"/>
</or>
</activation>
</usertask>
Find more posts tagged with
Comments
lhdavis
First, don't think you need the "\n\t" at the end of your INSERTs.
Second, you don't show it but you need <template_script tags around the optional value, in this case I think it's your QA_Review task
<template_script><![CDATA[
if (__VALUE__('QA') == 'true')
{
__INSERT__("<usertask name = 'QA_Review'
...
Since this task will only be active in case QA is set to true, you cannot just hardcode it as a task because when the workflow is instantiated it will **** out when it gets to your QA_Review task because nothing may be calling it (if the QA value is false).
I'm assuming the QA Review task has a Submit and Deploy successorset as well.
Oh, and now that I looked at it again you should probably use eq instead of == for a string comparison.
Luke Davis
Open Technology Group, Inc.
luke.davis@med.va.gov
peri
Thanks Luke for the response. I have made the changes you suggested in your post. However, after making those changes, when the workflow gets instantiated, it is directly jumping to the metadata capture task instead of going to _taginfo directives where an author would choose if they need QA approval or not.
I have attached the source file for the template. Any suggestions are greatly appreciated.
Thanks,
Murthy
lhdavis
Has your Metadata_Capture cgitask always been the start task and had the "immediate=t" option? I think this is a "feature" that occurs when you have a cgitask as your start task. If you throw in a simple Add_Files user task or remove the "immediate=t" option, you should be prompted to enter your TAG_INFO variables. I would start testing that way, just to make sure the optional QA review tasks work properly. Then you can figure out how to handle your Metadata_Capture.
Luke Davis
Open Technology Group, Inc.
luke.davis@med.va.gov
peri
Always had immidiate="t" for the cgitask. When I remove this attribute, the job capture form is not showing up and the workflow is waiting in metadata capture state. I looked at the newsgroups and someone posted regarding iw_first_time thing that will force the display of job_capture_form. Which do not work either.
Murthy
lhdavis
If you uncomment out the &debug line, do you see the job capture form?
Luke Davis
Open Technology Group, Inc.
luke.davis@med.va.gov
Migrateduser
Try setting your
is_required
attribute to "true".
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
peri
I think the issue here is that all TAG_INFO fields are optional and I guess the job capture form do not kick in for this condition. I made comments field as required and the job capture form is showing up. However, I am getting an error saying "can not add successors for Editor_Review" when I choose QA_Review in the job capture form.
When I ran through the debug, the xml looks just fine.
Again...Thanks for you help
Murthy
Migrateduser
post your job spec
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
peri
Here is the updated code. When I choose QA Review as required, then I am getting an error saying successorset is invalid.
Thanks,
Migrateduser
No, no. no....
Post your Job Spec. The XML. The /tmp/foo.xml file your debug code produces when you attempt to instantiate the job. You claimed that the XML looks good. It can't be good if the thing doesn't work. The WFT is hard to debug. The Job Spec is easy to debug.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
lhdavis
I agree with Smitty. Include your output XML and we'll see. My first guess if that it could be a single versus double quote issue. But looking at your XML will help with debugging.
Luke Davis
Open Technology Group, Inc.
luke.davis@med.va.gov
peri
Thank You guys...Here is the file...
lhdavis
First thing is to add a <!-- to line 264 which is currently:
============================================================ -->
Luke Davis
Open Technology Group, Inc.
luke.davis@med.va.gov
Migrateduser
What's the exact error you're getting?
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
peri
Guys..
Here is the xml when the workflow actually fails. Error is "Could not add successors to Editor_Review"
Thanks for all your help...
Murthy
lhdavis
I would also suggest making all of your quote consistent between the optional successorsets and the required ones.
So in your Editor_Review task make the Submit successorset and Metadata_Capture pred all single quotes. I seem to recall the workflow engine doesn't like mixing these.
]]></template_script>
<successorset description='Reject'>
<succ v='Submit'/>
</successorset>
</successors>
<activation>
<or>
<pred v='Metadata_Capture'/>
<template_script><![CDATA[
if (__VALUE__('QA') eq 'true')
{
__INSERT__("<pred v='QA_Review'/>");
}
]]></template_script>
</or>
</activation>
</usertask>
Do the same for your Submit task as well
<pred v='Editor_Review'/>
Luke Davis
Open Technology Group, Inc.
luke.davis@med.va.gov
nipper
Not certain but the fact that you have different quotes may be part of the issue:
<successorset description='Approve'>
<succ v='QA_Review' />
</successorset>
<successorset description="Reject">
<succ v="Submit"/>
You use double quotes in the latter and single in the former. We use double quotes all the
time. May not be the issue, but worth a shot.
Andy
Migrateduser
As if creating workflows wasn't hard enough...
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
peri
Alright Guys...Thanks for all your help. Its the combination of getting the quotes, and not having any of the job capture fields as required and not closing the xml comments properly.
Now it is working and really appreciate your responses.
Murthy