| Workflow Implementation Guide |
|
|
|
|
| Workflow Tips and Tricks > Workflow Escalation | |
This example requires familiarity with tokens and coding.
Workflow escalation (that is, dynamically routing workflow content to different people than listed users) is a common workflow requirement. While this is easily accomplished with jumps and parsing of some criteria (for example, date, action, metadata) there is often some initial confusion or hesitation as to where or to whom the content should go.
The issue is further complicated when the solution is to add a larger number of step users and to require only a subset of those users to approve the content before it can move on. This workflow will still generate and send out emails and appear in the workflow queue of non-approving users, users out of the office, and others who are there "just in case" some primary reviewer is not available.
This solution incorporates two custom user metadata fields, a token, and workflow step entry and update event code.
OutOfOfficeBackup
The OutOfOffice field is a flag that the user will set as TRUE when s/he is out of the office. The user sets this flag by selecting the TRUE option from the drop down choice list and updating her/his user profile by clicking the update button.
The OutOfOfficeBackup field contains the user name(s) of those users who can fill in as proxies for the out-of-office user. This field will optimally contain a single user name, formatted exactly as it appears in the User Admin applet.
When the following workflow step event code finds that one of the listed users is "out of the office" it switches that user's name for the listed proxy (as designated by the value in the OutOfOfficeBackup field). The workflow step then restarts with only the users who had not yet approved the content and any designated proxies.
A token pulls the list of users out of the companion file and sets them as step users. Special workflow messages are sent to designated proxies while the content was sitting in the update step event.
DynamicStepUsers <$if wfGet("dsu")$>
<$wfAddUser(wfGet("dsu"), "user")$>
<$else$>
<$wfAddUser("sysadmin", "user")$>
<$endif$>
<$if wfGet("dsa")$>
<$wfAddUser(wfGet("dsa"), "alias")$>
<$endif$>
The token pulls a value for the custom variable dsu and dsa out of the companion file. If no value is found for dsu then the sysadmin user is added as a precaution. The initial values for dsu and dsa are listed in the entry event of the step. Users only: If you need to assign users to the step(s), add the first contributor to the first step and the next step must include the first user plus the next user, user two.
<$restartFlag=wfGet("restartStep")$>
See if we got here due to a restart for new backup users. If so, suppress notifications to old users and notify only new ones
<$if restartFlag$>
<$if toInteger(wfGet("restartStep"))>=1$>
<$wfSet("wfJumpEntryNotifyOff", "1")$>
<$oooUsers=wfGet("outOfOfficeUsers")$>
<$if strIndexOf(oooUsers,",")>=1$>
Check for multiple out of office users
<$wfMessage=eval("The Following Users are out of the office: <$oooUsers$>
\nYou are the designated backup for one of them.\n
The content item <$dDocName$> is in the workflow step <$dwfStepName$> awaiting your review")$>
<$else$>
<$wfMessage=eval("The Following User is out of the office: <$oooUsers$>
\nYou are the designated backup for this user.\n
The content item <$dDocName$> is in the workflow step <$dwfStepName$> awaiting your review")$>
<$endif$>
<$rsMakeFromString("ooou",oooUsers)$>
<$loop ooou$>
<$userBackupName=row&"_Bkup"$>
<$wfNotify(wfGet(userBackupName),"user")$>
<$endloop$>
<$wfSet("restartStep","0")$>
<$endif$>
<$else$>
<$wfSet("restartStep","0")$>
<$endif$>
Set your step users here. Multiple users should be comma-separated, user names should be in quotes, metadata field references are unquoted. This example proceeds, using user names rather than aliases. Slight code re-working is required if using aliases.
<$dynamicStepUsers= <LIST USER NAMES IN QUOTES HERE>$>
<$if strIndexOf(dynamicStepUsers,",")>=1$>
If there are multiple users specified check to see if any of the MULTIPLE users are out of the office
<$rsMakeFromString("multiDynamicUsers",dynamicStepUsers)$>
<$loop multiDynamicUsers$>
<$if strEquals(getValueForSpecifiedUser(row,"uOutOfOffice"),"true")$>
If user is out of office, get their backup
<$backup=getValueForSpecifiedUser(row,"uOutOfOfficeBackup")$>
Replace out-of-office user in users list with their backup
<$dynamicStepUsers=strReplace(dynamicStepUsers,row,backup)$>
<$endif$>
<$endloop$>
<$else$>
Check to see if the SINGLE user is out of the office
<$if strEquals(getValueForSpecifiedUser(dynamicStepUsers,"uOutOfOffice"),"true")$>
If user is out of office, get their backup
<$dynamicStepUsers=getValueForSpecifiedUser(dynamicStepUsers,"uOutOfOfficeBackup")$>
<$endif$>
<$endif$>
<$wfSet("dsu",dynamicStepUsers)$>
Set the dsu variable into the companion file with listed and backup users
<$remainingUsers=wfGet("wfUserQueue")$>
Get users who have yet to approve
<$rsMakeFromString("ru", remainingUsers)$>
<$loop ru$>
<$if strEquals(getValueForSpecifiedUser(row,"uOutOfOffice"),"true")$>
Check the remaining users to see if they are out of the office
<$if getBackup$>
Create list of users requiring backup substitutes
<$getBackup=row &","&getBackup$>
<$else$>
<$getBackup=row$>
<$endif$>
<$endif$>
<$endloop$>
<$if getBackup or strLength(getBackup)>0 $>
If one of the users is listed as out of office then rewrite the user list and restart the step
<$wfSet("outOfOfficeUsers",getBackup)$>
<$rsMakeFromString("needBkup", getBackup)$>
<$loop needBkup$>
<$bkupUser=getValueForSpecifiedUser(row,"uOutOfOfficeBackup")$>
<$newRemainingUsersList=strReplace(remainingUsers,row,bkupUser)$>
<$wfSet(row&"_Bkup",bkupUser)$>
<$endloop$>
<$wfSet("dsu",newRemainingUsersList)$>
<$getBackup=""$>
<$wfSet("wfJumpTargetStep", wfCurrentStep(0))$>
<$wfSet("restartStep","1")$>
<$endif$>
|
|
|
Copyright © 1996, 2007, Oracle. All rights reserved |