If / Switch
Use conditional logic to create dynamic workflows that respond to your data. Route messages, trigger actions, and control your automation flow based on real-time conditions.
Types of Control Flow
If
The If
node routes workflow execution based on a single condition. When the condition evaluates to true, the workflow follows the True branch; otherwise, it follows the False branch.
Switch
The Switch
node allows routing based on multiple conditions.
It evaluates conditions in order and routes to the first matching branch.
If no conditions match, the workflow follows the default branch.
Condition Sources
The If
and Switch
nodes can evaluate boolean expressions from four different condition sources.
Data | Compare values from the automation context’s data object |
Profile | Compare values from the automation context’s profile object |
Step Ref | Monitor status of previous Send steps |
JS Condition | Write custom JavaScript for complex logic |
Data
Compare a field within the data
key of the automation context with a value.
Property | Description | Example |
---|---|---|
Field | The data object to evaluate | data.foo |
Comparison | The comparison operator to use | is one of |
Value | The value to compare against | bar, baz |
Profile
Compare a field within the profile
key of the automation context with a value.
Property | Description | Example |
---|---|---|
Field | The profile object to evaluate | address.country |
Comparison | The comparison operator to use | is |
Value | The value to compare against | Canada |
Step Ref
Check the current status of an upstream Send node, using it’s reference ID (Ref). The Ref value is defined in the Send node’s configuration.
Property | Description | Example |
---|---|---|
Ref | The send node’s status object | welcome_email.status |
Comparison | The comparison operator to use | is not |
Value | The value to compare against | CLICKED |
Possible status values are: CLICKED
, DELIVERED
, ENQUEUED
, FILTERED
, OPENED
, SENT
, SIMULATED
, UNDELIVERABLE
, UNMAPPED
, UNROUTABLE
JS Condition
Use JavaScript expressions when standard comparisons aren’t sufficient.
Property | Description | Example |
---|---|---|
Expression | The javascript expression to evaluate | data.expiry < (new Date()).getTime() |
Javascript Expressions in Value Fields
Javascript expressions can also be used in the Value
field of Data, Profile, and Step Ref sources.