Add a Decision to a Workflow
Use a decision block in your workflow to determine which step to run next depending on logic you specify.
For example, the workflow below sends an invoice to the customer. The workflow follows a different path depending on whether the customer has email or not.
A decision can have only two outcomes: Yes and No.
To add a decision to a workflow, you need to:
-
Add and connect the decision to the workflow.
-
Define the decision logic.
Add and Connect the Decision
-
Open the workflow.
-
Drag and drop a decision onto the workflow canvas.
-
Click the decision.
-
Click on one of the anchors around the decision and drag a connector towards the step that must be performed if decision answer is Yes.
-
Click on another of the anchors around the decision and drag a connector towards the step that must be performed if decision answer is No.
-
To rename the decision, either
-
Double-click the decision and edit the text, or
-
Right-click the decision, select Rename Step, and edit the text.
-
Define Decision Logic
The logic of a decision is defined in the Builder area below the workflow canvas.
The decision below checks whether the value of the Email property of the Customer variable is not empty. If the property is found to be not empty, then the Yes transition will be followed. Otherwise, the No transition will be followed.
The list of comparison operators displayed depends on the type of values entered into the properties of the If statement. For example, for text values the list of comparison operators includes is empty, matches, and contains. Those options are not available if number values are entered. The table below lists the operators and explains how they are applied to each variable type.
Operator |
Text |
Number & Decimal |
Date/Time |
Boolean |
---|---|---|---|---|
equals | The two strings are identical and are of same case. | The values are equal. | Both dates and times are equal. | The values are equal. |
equals (ignore case) |
The two strings are identical. If the only differences are in case, the strings are considered equal. |
N/A | N/A | N/A |
Operator |
Text |
Number & Decimal |
Date/Time |
Boolean |
---|---|---|---|---|
does not equal |
The two strings are not the same or not of the same case. |
The values are not equal. | The dates and/or times are not equal. | The values are not equal. |
does not equal (ignore case) |
The two strings are not the same. If the only differences are in case, the strings are considered equal. |
N/A | N/A | N/A |
is larger than |
The left string is alphabetically later than the right string. |
The left value is larger than the right value. | The left date/time is later than the right date/time. | N/A |
is smaller than |
The left string is alphabetically earlier than the right string. |
The left value is smaller than the right value. | The left date/time is earlier than the right date/time. | N/A |
is not larger than | The left string is not alphabetically later than the right string. | The left value is not larger than the right value. | The left date/time is not later than the right date/time. | N/A |
is not smaller than |
The left string is not alphabetically earlier than the right string. |
The left value is not smaller than the right value. | The left date/time is not earlier than the right date/time. | N/A |
contains | The left string contains the text in the right string in the same case as in the right string. | N/A | N/A | N/A |
contains (ignore case) | The left string contains the text in the right string but not necessarily in the same case as in the right string. | N/A | N/A | N/A |
does not contain | The left string does not contain the text in the right string in the same case as in the right string. | N/A | N/A | N/A |
does not contain (ignore case) | The left string does not contain the text in the right string. Differences in case are ignored. | N/A | N/A | N/A |
is empty | The string is empty. | N/A | N/A | N/A |
is not empty | The string is not empty. | N/A | N/A | N/A |
matches (wildcard) |
The two strings are identical and are of same case. Wildcards are supported:
|
N/A | N/A | N/A |
matches (wildcard, ignore case) |
The two strings are identical. If the only differences are in case, the strings are considered to match. Wildcards are supported:
|
N/A | N/A | N/A |
does not match (wildcard) |
The two strings are not the same or not of the same case. Wildcards are supported:
|
N/A | N/A | N/A |
does not match (wildcard, ignore case) |
The two strings are not the same. If the only differences are in case, the strings are considered to match. Wildcards are supported:
|
N/A | N/A | N/A |
To define decision logic:
-
Click the first parameter to open the Selector window.
-
Select any simple variable, a property of a complex variable, or a function or method that returns an output of the correct type and does not require input parameters.
-
Click .
-
Select the logic operator to apply from the drop-down list.
-
Specify the second parameter if necessary. Some logic operators do not require a second parameter.
The full process is demonstrated in the video below.
Define Compound Decision Logic
You can define compound logic by combining multiple conditions using AND and OR logic.
For example, this workflow decides whether or not to send an invoice to a customer.
An invoice should only be sent if:
-
The amount owed is larger than $10, AND
-
The customer's email address is known, OR if the customer's postal address is known.
The logic definition is shown below:
Use the following controls:
Add a sibling condition
Add a group
Ungroup
Delete a condition
Set the logic to apply within a group.
The full process is demonstrated in the video below.
Modify a Decision
Once a decision has been placed on the workflow canvas, right-click the decision to:
-
Open the Usage Reference panel to identify if and where the decision is referenced in the project.
-
Rename the decision.
-
Delete the delete the decision.