Condition Block

Use the Condition Block activity to specify multiple paths for your workflow based on a series of one or more conditions. These are the same as a traditional if/then/else type statements in scripting.

Condition Block

Hints

  • Condition blocks can have one or more branches. A single branch is useful for checking a condition and, if true, ending a workflow.
  • Branches are evaluated from left to right. Only the first branch with a true condition is executed.
  • Treat condition activities as questions and condition branches as concrete answers.
  • You are not required to have a branch that accounts for every scenario. If none of the branches have a true condition, none of them will be executed and the workflow will continue past the condition block.

Building a Condition

Condition branches are only executed if their condition is true. As with any standard conditional, these conditions have a left operand, operator, and right operand. The item on the left is compared to the item on the right using the operator chosen. For example:

Condition

The left operand must always be a variable. The right operand can be another variable or a value you enter, depending on the data type of the variable.

Operators

The operators available within a condition vary depending on the type of values being compared. Here is a summary of what is available by data type:

Data Type Operators
Array (data type that can store multiple values of different data types sequentially) Does not include, Includes, Includes item greater than, Includes item greater than or equals, Includes item less than, Includes item less than or equals,
Boolean Equals, Not equals
Date Time After, Before, Equals, No earlier than, No later than, Not equals
Decimal Equals, Greater than, Greater than or equals, Less than, Less than or equals, Not equals
Integer Equals, Greater than, Greater than or equals, Less than, Less than or equals, Not equals
Secure String Cannot be used with a condition block
String Does not match wildcard, Equals, Equals (Case InSensitive), Matches Regular Expression, Matches wildcard, Not equals

Combining Conditions

When building conditions, you can combine multiple conditions using AND or OR. You cannot easily mix the two because the order of operations becomes complicated. To add another condition to an existing one, click Add Condition below your existing condition and select whether you want it to be an AND or an OR. Then, you can provide the next condition and Automation will assemble the logic when the conditions are evaluated.

Building an Else Condition Branch

There is no else branch in Automation. To have a branch function as an else, you must either set its condition to the opposite of the other branches (explicit) or to something that is always true (implicit).

Explicit Else

An explicit else means that you make a condition branch whose condition is the opposite of every other branch. For example, if one branch checks for variable EQUALS value-a and another branch checks for variable EQUALS value-b, your condition for an else branch would be variable NOT EQUALS value-a AND variable NOT EQUALS value-b:

Explicit Else

Depending on how many branches you have and how complex the conditions are, this can become complicated. An implicit else is usually more efficient.

Implicit Else

An implicit else means creating a branch that is executed by default because its condition is always true. If you make a branch with a condition like this last (as in, the right-most branch within the condition block), it will always be executed if none of the other branch conditions are met. The easiest way to build a condition that is always true is to check if the workflow instance ID is equal to itself:

Implicit Else

Sample Workflows

The following sample workflows are available in our repository’s workflows folder to help you get familiar with this concept. These can be imported using the instructions in Import Git Content or you can click the workflow to view it in GitHub.