An If-Else activity is intended to select exactly one branch of the activity from a given set of branches. For each branch, the activity checks the branch conditions and executes the first of the branches whose condition evaluates to TRUE.
When you configure an If-Else branch, you need to add at least one condition, but you are not limited in the number of conditions that you can add for a given branch. You can add, delete, and group conditions using various operators. It is possible to nest condition groups within other condition groups to achieve the results that you want.
A condition group contains one or more conditions connected by the same logical operator. By grouping conditions, you specify that those conditions should be evaluated as a single unit. The effect is the same as if you put parentheses around an expression in a mathematical equation or logic statement.
By default, a single, implied condition group is created when you add a branch condition. You can create additional condition groups to group a set of conditions and nest grouped conditions within other condition groups.
In a condition group, conditions are connected using the AND, OR, NOT AND, or NOT OR logical operator:
- AND group evaluates to TRUE if all conditions in the group are TRUE.
- OR group evaluates to TRUE if any condition in the group is TRUE.
- NOT AND group evaluates to TRUE if any condition in the group evaluates to FALSE.
- NOT OR group evaluates to TRUE if all conditions in the group evaluate to FALSE.
By default, AND is the logical operator between the conditions in a condition group. It is possible to change the logical operator by converting the condition group to a different group type.
When you add a condition, the workflow designer first prompts you to specify what you want the condition to evaluate. The following options are available:
- Property of workflow initiator. This option is intended to evaluate the value of a certain property of the user whose request started the workflow. You can select the desired property when you configure a condition.
- Activity execution status. This option is intended to evaluate whether or not Active Roles encountered an error when executing a certain activity. You can select the desired activity when you configure a condition. Note that this option requires the activity configuration to allow the workflow to continue even if the activity encounters an error (see Error handling for create, read, update, and delete activities).
- Workflow parameter value. This option is intended to evaluate the value of a certain parameter of the workflow. You can select the desired parameter when you configure a condition.
- Property of object from workflow data context. This option is intended to evaluate the value of a certain property of the object that will be selected by the If-Else activity on the basis of the data found in the workflow environment at the time of executing the workflow. When you configure a branch condition, you can choose the desired property and specify which object you want the activity to select upon evaluating the condition at workflow run time.
- Value generated by rule expression. This option is intended to evaluate the string value of a certain rule expression. By using a rule expression, you can compose a string value based on properties of various objects found in the workflow environment at the time of executing the workflow. Active Roles calculates the value of your rule expression upon evaluating the condition at workflow run time.
Within a change workflow, the following options are available in addition to the options listed above:
- Property of workflow target object. This option is intended to evaluate the value of a certain property of the target object of the request that started the workflow. You can select the desired property when you configure a condition.
- Changed value of workflow target object property. This option is intended to evaluate the value that is requested to be assigned to a certain property of the workflow target object, which represents the requested change to the property of the target object of the request that started the workflow. You can select the desired property when you configure a condition.
- Approver action choice. This option is intended to evaluate the name of the action button applied by the approver to complete the approval task created by a certain Approval activity. Use this option to determine which action button the approver applied to allow the operation that was subject to approval. You can select the desired Approval activity when you configure a condition.
Once you have specified the entity or field that you want the condition to evaluate, you can choose a comparison operator and specify a comparison value. The list of options that are available to specify a comparison value depends upon the entity or field you have configured the condition to evaluate. The following table summarizes the comparison value options.
Condition to evaluate |
Comparison value options |
Property of workflow target object - OR - Property of workflow initiator - OR - Changed value of workflow target object property - OR - Workflow parameter value - OR - Property of object from workflow data context - OR - Value generated by rule expression |
|
Activity execution status |
|
Approver action choice |
For a brief description of comparison operators and comparison value options, see Search filter.