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
Add a Condition node
Define the rule
Connect the branches
Comparison Operators
| Operator | Description | Example |
|---|---|---|
| equals | Exact match (case-sensitive for strings). | status equals 'active' |
| not equals | Does not match. | status not equals 'archived' |
| contains | String includes the substring. | subject contains 'invoice' |
| starts with | String begins with the prefix. | email starts with 'admin@' |
| ends with | String ends with the suffix. | file ends with '.pdf' |
| greater than | Numeric comparison. | amount greater than 100 |
| less than | Numeric comparison. | retries less than 3 |
| is empty | Field is null, undefined, or empty string. | notes is empty |
| is not empty | Field 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.
// Route to 'urgent' branch if:
// priority is 'high' AND status is 'open'
Rule 1: priority equals "high"
Rule 2: status equals "open"
Logic: ANDMultiple 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
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
Add a Loop node
Configure the array path
gmail.messages.Build the loop body
Reference the current item
{{loop.item}} to reference the current array element and {{loop.index}} for the index.Loop Variables
| Variable | Type | Description |
|---|---|---|
| loop.item | any | The current element in the array. |
| loop.index | number | Zero-based index of the current iteration. |
// 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
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.