Switch task

A Switch task contains two sequences of tasks. Based on conditions specified as properties of a Switch task, it causes only one of its task sequences to be performed. After the task sequence has been performed, the task after the Switch task is performed. The Switch task is much like the traditional "If statement."

The following figure shows a simple example of a workflow that contains a Switch task.
Figure 1. Switch example
The image is explained in the text.

The sample workflow in the figure begins by creating a record. If the create task is successful, the record is modified and is then used for an action item created by the User Action task. If the create task is not successful, the workflow ends in failure.

One thing to notice about the switch task as it appears in the figure is that there is more of it than just its palette shape. The bottom of the switch task is where the two alternate task sequences come together. You can click the top or the bottom of a switch task to see its properties.

The properties form for a switch task is shown in the following figure. The properties form for a switch task has more actions than we have seen in previous task forms. Like other task property forms, it has a Delete action to delete the task from the workflow. Be particularly careful when deleting a switch task from a workflow, because deleting a switch task also deletes the task sequences contained in the switch task.
Figure 2. Switch properties
The image is explained in the text.

The contents of the Switch task form is a condition that is either true or false. If the condition is true when a switch task is performed, the task sequence attached to the green circle is performed. If the condition is false, the task sequence attached to the red square is performed.

The Swap action swaps the positions of the green circle and the red square, while leaving the task sequences where they are. After a Swap action, the task sequence that was attached to the green circle is attached to the red square and the task sequence that was attached to the red square is attached to the green circle.