Skip to main content
Execution flow commands enable you to control the execution flow of your workflows including conditional logic, loops, branching, and flow control. These commands are essential for building complex workflows with conditional execution paths.

Overview

Execution flow commands provide functionality for:
  • Conditional execution (if/else logic)
  • Looping and iteration
  • Branching and flow control
  • Error handling and recovery
  • Workflow orchestration

Common Use Cases

  • Conditional Logic: Execute commands based on conditions
  • Iteration: Loop through data arrays or collections
  • Error Handling: Handle errors and retry logic
  • Workflow Branching: Create multiple execution paths
  • Flow Control: Control step and command execution order

Command Parameters

Execution flow commands typically support the following parameters:
ParameterTypeDescriptionRequired
conditionstring/objectCondition expression for conditional executionYes (for conditional commands)
thenarrayCommands to execute if condition is trueYes (for conditional commands)
elsearrayCommands to execute if condition is falseNo (for conditional commands)
loopobjectLoop configurationYes (for loop commands)

Flow Control Patterns

Conditional Execution

Execute commands based on conditions:
{
  "command": "conditional",
  "params": {
    "condition": "${data.length > 0}",
    "then": ["command1", "command2"],
    "else": ["command3"]
  }
}

Looping

Iterate over data collections:
{
  "command": "loop",
  "params": {
    "loop": {
      "source": "${items}",
      "commands": ["process-item"]
    }
  }
}

Best Practices

  • Clear Conditions: Use clear, testable condition expressions
  • Handle Edge Cases: Account for null, undefined, and empty values
  • Avoid Infinite Loops: Ensure loops have proper exit conditions
  • Test Flow Logic: Verify conditional logic works as expected
  • Document Flow: Document complex flow logic for maintainability