Skip to main content

Flow Control

Flow control steps determine which steps execute and in what order. They enable branching, looping, and early termination of flows.

Condition

Executes different steps based on whether a condition is true or false.

ParameterDescription
ConditionExpression that evaluates to true or false

The Condition step creates two branches:

  • True Branch: Steps to execute if condition is true
  • False Branch: Steps to execute if condition is false

Example:

CONDITION: Is High Value Order?
Condition: Order.TotalAmount > 10000

TRUE BRANCH:
→ Send to manager for approval
→ Create high-priority task

FALSE BRANCH:
→ Auto-approve order
→ Send confirmation email

Nested Conditions: You can nest conditions within branches to create complex decision trees:

CONDITION: Is Customer Premium?
Condition: Customer.Tier == "Premium"

TRUE BRANCH:
CONDITION: Has Active Contract?
Condition: Contract.Status == "Active"

TRUE BRANCH:
→ Apply 20% discount

FALSE BRANCH:
→ Apply 10% discount

FALSE BRANCH:
→ Apply standard pricing

Switch

Executes different steps based on which value matches - like a multi-way condition.

ParameterDescription
OperandThe value to evaluate against the cases
CasesAn ordered list of cases, each with a match expression and steps to execute

Each case has an Expression (the value to compare against the operand) and a set of steps. The operand is compared to each case expression in order; the first case whose value is equal to the operand runs, and evaluation stops. If no case matches, no steps run.

note

Switch does not have a built-in default/else branch. To handle unmatched values, follow the Switch with a Condition, or include a catch-all case whose expression matches your fallback value.

Example:

SWITCH: Order Priority
Operand: Order.PriorityCode

CASE "Critical":
→ Assign to senior team
→ Set SLA to 2 hours

CASE "High":
→ Assign to standard team
→ Set SLA to 8 hours

CASE "Normal":
→ Add to queue
→ Set SLA to 24 hours

Loop

Repeats a set of steps for a range of counter values.

ParameterDescription
Start IndexThe starting value of the loop counter
CountThe upper bound of the loop counter

The loop counter runs from Start Index up to and including Count (the bound is inclusive), and the current counter value is available to the steps inside each iteration.

Example:

LOOP: Create Monthly Tasks
Start Index: 1
Count: 12

Steps:
→ Create Task with Subject: "Monthly Review - Month " + <current index>

Iterator

Repeats steps for each item in a collection.

ParameterDescription
CollectionThe collection to iterate over

The Iterator exposes the current item and a 1-based current index to the steps inside each iteration.

Example:

ITERATOR: Process Each Line Item
Collection: OrderLineItems

Steps:
→ Calculate line total: <current item>.Quantity * <current item>.UnitPrice
→ Update inventory for <current item>.Product
→ Create shipment record

Sequential

Groups a set of steps that execute one after another as a single unit. Sequential is primarily used to bundle several steps together where a single step is expected (for example inside a branch or a case), or to keep a related set of steps visually and logically grouped.

ParameterDescription
StepsThe ordered list of steps to run in sequence

Execution stops early if a grouped step halts the flow.

Nested Iterators: You can nest iterators to process hierarchical data:

ITERATOR: Process Each Order
Collection: CustomerOrders
Item Variable: Order

Steps:
ITERATOR: Process Each Line Item
Collection: Order.LineItems
Item Variable: LineItem

Steps:
→ Process LineItem

Break

Exits the current loop or iterator early.

Use Break when a condition is met that means no further iterations are needed.

Example:

ITERATOR: Find First Match
Collection: Candidates
Item Variable: Candidate

Steps:
CONDITION: Is Match?
Condition: Candidate.Score > 90

TRUE BRANCH:
→ Set SelectedCandidate = Candidate
→ BREAK

Halt

Stops the entire flow execution immediately.

Use Halt when a critical condition is met that prevents the flow from continuing meaningfully.

Example:

CONDITION: Is Valid Request?
Condition: Request.ApiKey != null AND Request.ApiKey == ValidKey

FALSE BRANCH:
→ Log unauthorized access attempt
→ HALT
warning

When a flow is Halted, any outputs set before the Halt will still be returned. Make sure to set appropriate error outputs before halting if needed.

Best Practices

Keep Branches Focused: Each branch should have a clear, single purpose. If a branch is getting complex, consider extracting it to a sub-flow.

Avoid Deep Nesting: More than 3-4 levels of nested conditions or loops becomes hard to understand. Refactor into separate flows or use Switch instead of nested conditions.

Use Break Appropriately: Break exits only the innermost loop/iterator. If you need to exit multiple levels, consider restructuring or using Halt.

Handle All Cases: In Switch statements, always include a default case to handle unexpected values gracefully.

Consider Performance: Iterating over large collections can be slow. Use Execute Query with appropriate filters to minimize the collection size before iterating.