Monday, October 10, 2011

How to use and configure timeouts in workflows

How do you set up approval escalations in workflow?
ANSWER:
A manual action has an attribute called timeout. This value is defined in
minutes if it is a positive number, or seconds if it is a negative number. 
For example, a timeout of two minutes could be represented as either timeout='2'
or timeout='-120'. After setting the action and timeout, you will need to define
the transitions from this activity to the next. You can evaluate the
WF_ACTION_TIMEOUT variable to see if it is true and if so transition to an
escalation activity. 

The following is an example of the create user workflow that has been modified
to call an 'escalate' activity if a timeout value is reached. If the timeout is
not reached, then the results of the APPROVED variable are evaluated which
decides whether to transition to the approved or rejected activity. 

    <Activity name='Wait'> 

      <ManualAction name='approve' timeout='180'> 
        <Owner name='$(APPROVER)'/> 
        <Variable name='APPROVAL' value='false'/> 
        <Return from='APPROVAL' to='APPROVED'/> 
        <FormRef> 
          <ObjectRef type='UserForm' id='#ID#UserForm:ApprovalForm'/> 
        </FormRef> 
        <ReportTitle> 
          <concat> 
            <s>Awaiting approval from \n</s> 
            <ref>APPROVER</ref> 
          </concat> 
        </ReportTitle> 
      </ManualAction> 

      <Transition to='Escalate'> 
        <eq> 
          <ref>WF_ACTION_TIMEOUT</ref> 
          <s>true</s> 
        </eq> 
      </Transition> 

      <Transition to='Approved'> 
        <eq><ref>APPROVED</ref><s>true</s></eq> 
      </Transition> 

      <Transition to='Rejected'/> 

    </Activity>

No comments:

Post a Comment