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 cases

The Switch step allows multiple case branches, each with a value to match and steps to execute. Include a default case for unmatched values.

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

DEFAULT:
→ Add to backlog
→ Set SLA to 48 hours

Loop

Repeats a set of steps a specified number of times.

ParameterDescription
Start IndexThe starting value of the loop counter
CountNumber of iterations to perform

The loop provides access to the current index during each iteration.

Example:

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

Steps:
→ Create Task with Subject: "Monthly Review - Month " + MonthNumber

Iterator

Repeats steps for each item in a collection.

ParameterDescription
CollectionThe collection to iterate over

The Iterator provides access to the current item and index during each iteration.

Example:

ITERATOR: Process Each Line Item
Collection: OrderLineItems
Item Variable: LineItem
Index Variable: ItemIndex

Steps:
→ Calculate line total: LineItem.Quantity * LineItem.UnitPrice
→ Update inventory for LineItem.Product
→ Create shipment record

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.