Testing Business Services for Failure

The “on-fail” option allows the workflow to continue if a business service fails (default is to abort workflow).

This example shows a ticket to test for failure and take some appropriate action. When a business service completes, the “fail” attribute is set to “1” (failure) or “0” (success). This attribute can be used in a flow control statement as follows. If ‘render’ is successful then the rendition is added to the document. Otherwise, the document is moved to another folder. In this example, ‘render’ has failed (“fail’ is set to “1”).

<workflow job-name="Test Workflow" submitter="John" product="Vista">
<retrieve>
<request tag="request1" name="retrieve-document">
<URL type="string">dms://dctm/borg/09015bda800081db?label=CURRENT</URL>
<content-type type="string">doc</content-type>
</request>
</retrieve>
<render tag="render-pdf” on-fail="continue" fail="1">
<request tag="request2 ">
<document-name
type="string">dms://dctm/borg/09015bda800081db?label=CURRENT
</document-name>
<local-path type="string"
from="retrieve/request[@tag='request1']/local-path">
</local-path>
<force-rendition type="bool">1</force-rendition>
</request>
</render>
<flow-control>
<variable name="FAIL" from="render[@tag=’render-pdf’]" attr="fail" />
<if expression="FAIL = 1">
<goto>distribute[@tag=’error’]</goto>
</if>
</flow-control>
<distribute>
<request tag="request3" name="distribute-rendition">
<URL type="string">dms://dctm/borg/09015bda800081db?label=CURRENT</URL>
<local-path type="string"
from="render/request[@tag='request2']/local-rendition-path">
</local-path>
<format type="string">pdf</format>
</request>
</distribute>
<flow-control>
<end/>
</flow-control>
<distribute tag="error">
<request tag="request4" name="distribute-move">
<URL type="string">dms://dctm/borg/09015bda800081db?label=CURRENT</URL>
<to-folder-URL type="string">
dms://dctm/borg/09015bda800081db?type=2
</to-folder>
<to-subfolder type="string">Error</ to-subfolder>
</request>
</distribute>
</workflow>