Angela Lindsey Blog

As Simple as “Else” – Workflow Routing Made Easy

TekTalkBlogHeader

As Simple as “Else” – Workflow Routing Made Easy

By: Angela Lindsey | WebCenter Content Senior Developer

Workflow can be as simple as Step1-Approve and Released. In the majority of cases there are complex step names and within them even more complex scripts to drive an item based on metadata, user, rejection location and almost any other variable that can be thought of. A creative developer can literally make workflow routing magic happen with enough time and testing.

Have you ever had an item enter a workflow step (EntryStep) and jump to the next step based on the value of one or more metadata fields?  What if you give it the option to jump to multiple places based on metadata? What if more than one option is true? Here is the example:

dDocName-00002
dDocTitle-DocumentA
dDocType-Contract
xLegalShouldReview-Yes

The workflow is setup that all Contracts should go to the ExecutiveReview step in workflow and if any other flags are met they should go there first and then to ExecutiveReivew.

This should achieve this solution right?

<$if xLegalShouldReview like “Yes”$>

<$wfSet(“wfJumpTargetStep”, “LegalReview@WorkflowName”)$>

 

<$endif$>
<$if dDocType like “Contract”$>

<$wfSet(“wfJumpTargetStep”, “ExecutiveReview@WorkflowName”)$>

<$endif$>

Wrong.  The item will meet both criteria but only jump on the last criteria met – so even though it’s flagged to go to LegalReview it will instead jump to ExecutiveReview.  This is where the power of <$else$> comes in.  If we change the code to be the following – it will pick up the first flag and jump instead of moving to the next flag.

<$if xLegalShouldReview like “Yes”$>

<$wfSet(“wfJumpTargetStep”, “LegalReview@WorkflowName”)$>
<$else dDocType like “Contract”$>

<$wfSet(“wfJumpTargetStep”, “ExecutiveReview@WorkflowName”)$>

<$endif$>

Changing from two ifs forces the item to make a decision and it will take the first one instead of the second since that criteria is met first.

It is as simple as ELSE.

Contact Angela Lindsey about Workflow Routing Today.

We're here to help!