Documentation Center

Setting the Return Value for a Sub-Workflow

Every sub-workflow must return a status to its parent workflow, which determines the transition to take when continuing the workflow. The return value can be set implicitly or explicitly.

If the return value is set implicitly (that is, it is not set explicitly), the following rules are used:
  • If the workflow reaches the Finish step without being canceled, the workflow has a return value of Success.
  • If the workflow reaches the Cancel step, the workflow has a return value of Failure.

A workflow explicitly sets its completion status by using the Set Return Value automatic action. This action has a single parameter: Success value. If this parameter is set to 1, the sub-workflow has a result of Success. If the value is 0, the sub-workflow has a result of Failure.

For example, a customer wants to implement a review process as a sub-workflow. The Review.SWF workflow might look like this:

Figure 1. Sample Workflow Including the Set Return Value Step

In this workflow, if the review is rejected, then the top Set Return Value sets the status for the whole workflow to Failure. Otherwise, the Set Return Value action that follows the Approve step sets the status to Success.

This workflow can be used in the parent workflow shown in the following figure:

Figure 2. Sub-workflow Review Process with Success and Failure Transitions