You can create a conditional branch so that a step within a service template is run only when a particular condition is met.
A conditional branch is useful for running a step based on a condition that occurs during the processing of a previous step.
The following plug-ins are provided for creating a conditional branch:
- Branch by Property Value Plug-in: Compares a service property with a specified value (or if necessary, can also be compared with a variable or step property) and then acts accordingly.
- Branch by ReturnCode Plug-in: Compares the Return Code generated by a previous step with a value.
To create a conditional branch:
- Insert the branching plug-in at the point in the flow after the step where you want the branch to occur.
- Position the step to run, if the condition is met, beneath the branch and the position of the next steps.
- Draw connectors between the steps to define the flow.
- Set the input and output values to define the condition and specify the values.
The following figure shows an example of using the Branch by Property Value Plug-in to set up a conditional branch when a step property generated by a previous step equals the specified value.
In this example, "Step A," is run only when "out0" from the previous step equals "test."
The following figure shows an example of using the Branch by ReturnCode Plug-in to set up a conditional branch when a return code generated by a previous step meets a specified criteria.
In this example, "Step A" is run only when the return code from the previous step equal "0."
To create a more complex conditional branching, you can use multiple Branch by Returncode plug-ins so that one step is run when a condition is met and another step is run when the condition is not met.