Each task has a parameter in the Pass and Fail columns. This indicates the next step to take when an action passes successfully or fails. Clicking on a parameter brings up the default values:
- Next: Move to the next task in the sequence
- End: End the business process with an error
Here is where creating a label for each task is helpful. If you create labels for each task, when you click on a task's Pass or Fail parameters, the labels will appear in addition to the default values. This allows greater customization of the Business Process.
For example, if you wish to send you an email when any task listed in the Business Process fails. You could set up a Business Process like this:
This way, the Business Process will:
- Attempt to read the data from a file. If it fails, it will send an email. If it passes, it will move to the next task, in which it will...
- Attempt to transform the data with the Ruleset. If it fails, it will send an email. If it passes, it will move to the next task, in which it will...
- Attempt to write the data to a file. If it fails, it will send an email. If it passes, it will move on to the pass task.
- If at any point, the email is invoked, the Studio will attempt to send an email. Whether the email works or not, the Business Process as a whole failed, so it will move on to the fail task.
- The pass task sets a successful exit status and the Business Process ends.
- The fail task sets an unsuccessful exit status and the Business Process ends.
It is OK to leave the Pass and Fail columns at the default next and end parameters if you don't have a reason to change them. The final task will automatically know to end if it is the last task even if it is left at next in the Pass column.
Pass/Fail Parameters when using Control Flow tasks (If/Then/Else, For Each, Do While, While Do)
Task labels and pass/fail parameters can still be still used to control the sequence of logic in a Business Process. While task labels and pass/fail parameters can be used at the control flow task level (If/Then/Else, for example) they cannot be used by the sub-tasks contained within control flow tasks themselves.