Conditions & Loops

Control the flow of your workflows with branching logic, iteration, and advanced routing patterns.

Condition Nodes

A Condition node evaluates a rule and routes execution to different branches based on the result. It is the fundamental tool for if/then/else logic in your workflows.

Setting Up a Condition

1

Add a Condition node

Drag a Condition node from the Logic section of the node library onto the canvas.
2

Define the rule

In the configuration panel, select the field to evaluate (using the data picker), choose an operator, and enter the comparison value.
3

Connect the branches

The Condition node has two output handles: True and False. Draw edges from each handle to the appropriate downstream nodes.

Comparison Operators

OperatorDescriptionExample
equalsExact match (case-sensitive for strings).status equals 'active'
not equalsDoes not match.status not equals 'archived'
containsString includes the substring.subject contains 'invoice'
starts withString begins with the prefix.email starts with 'admin@'
ends withString ends with the suffix.file ends with '.pdf'
greater thanNumeric comparison.amount greater than 100
less thanNumeric comparison.retries less than 3
is emptyField is null, undefined, or empty string.notes is empty
is not emptyField has a value.assignee is not empty

Compound Conditions

Combine multiple rules using AND or OR logic. Click Add Rule in the configuration panel to add additional criteria.

  • AND — all rules must be true for the True branch to activate.
  • OR — at least one rule must be true for the True branch to activate.
Example compound condition
// Route to 'urgent' branch if:
//   priority is 'high' AND status is 'open'

Rule 1: priority equals "high"
Rule 2: status equals "open"
Logic: AND

Multiple Branches

For more than two outcomes, chain multiple Condition nodes. The first condition handles the primary split; downstream conditions handle secondary splits. This pattern creates a decision tree.

Pattern: switch/case

Chain conditions to simulate a switch statement: first check for "high", then "medium", then default to "low". Each branch connects to a different action path.

Loop Nodes

A Loop node iterates over an array and executes the connected downstream nodes once for each item. Use loops when you need to process a list of items individually — sending an email to each contact, creating a Jira issue for each bug, or posting each message in a batch.

Setting Up a Loop

1

Add a Loop node

Drag a Loop node from the Logic section. It needs an array to iterate over.
2

Configure the array path

In the configuration panel, use the data picker to select the array field from an upstream node. For example: gmail.messages.
3

Build the loop body

Connect downstream nodes to the Loop node's output handle. These nodes execute once per array item.
4

Reference the current item

Inside the loop body, use {{loop.item}} to reference the current array element and {{loop.index}} for the index.

Loop Variables

VariableTypeDescription
loop.itemanyThe current element in the array.
loop.indexnumberZero-based index of the current iteration.
Loop usage example
// Array: gmail.messages = [
//   { subject: "Q1 Report", from: "cfo@acme.com" },
//   { subject: "Meeting notes", from: "pm@acme.com" }
// ]

// In a Slack node inside the loop:
"Processing email {{loop.index + 1}}: {{loop.item.subject}} from {{loop.item.from}}"

// Iteration 1: "Processing email 1: Q1 Report from cfo@acme.com"
// Iteration 2: "Processing email 2: Meeting notes from pm@acme.com"

Nested Loops

You can place a Loop node inside another Loop. The inner loop iterates over a nested array within each outer item. Reference the outer loop's item with the outer Loop node's ID in the data path.

Performance

Nested loops multiply execution count. A 100-item outer loop with a 50-item inner loop means 5,000 iterations. Monitor execution time and token usage closely.

Common Patterns

Filter Then Process

Use a Condition inside a Loop to filter items before processing. The Loop iterates over all items; the Condition node routes matching items to the action branch and skips non-matching items.

Fan-Out / Fan-In

Route items to different actions based on type, then merge results. For example: emails from VIP senders go to the urgent channel; everything else goes to the general channel.

Error Handling Branch

Add a Condition after a node that might fail. Check the node's error output and route to an error-handling path (send alert, log to database) while the success path continues normally.