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.

DataCompare values from the automation context’s data object
ProfileCompare values from the automation context’s profile object
Step RefMonitor status of previous Send steps
JS ConditionWrite custom JavaScript for complex logic

Data

Compare a field within the data key of the automation context with a value.

PropertyDescriptionExample
FieldThe data object to evaluatedata.foo
ComparisonThe comparison operator to useis one of
ValueThe value to compare againstbar, baz

Profile

Compare a field within the profile key of the automation context with a value.

PropertyDescriptionExample
FieldThe profile object to evaluateaddress.country
ComparisonThe comparison operator to useis
ValueThe value to compare againstCanada

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.

PropertyDescriptionExample
RefThe send node’s status objectwelcome_email.status
ComparisonThe comparison operator to useis not
ValueThe value to compare againstCLICKED

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.

PropertyDescriptionExample
ExpressionThe javascript expression to evaluatedata.expiry < (new Date()).getTime()
JS Condition examples
// Transform and compare values 
data.email.toLowerCase().includes('@company.com')

// Check for key existence or null values 
'preferences' in data && data.preferences !== null

// Compare date diffs as ISO strings 
Date.parse(data.lastLogin) < Date.now() - (30 * 24 * 60 * 60 * 1000)

// Manipulate nested arrays and objects 
data.orders.filter(order => order.total > 100).length > 0

Javascript Expressions in Value Fields

Javascript expressions can also be used in the Value field of Data, Profile, and Step Ref sources.

Examples
// Dynamic timestamps
${(new Date()).getTime()}

// Concatenate values
${data.firstName + ' ' + data.lastName}

// Default values
${profile.language || 'en'}