Flow control steps
Flow control steps allow you to add logic, conditionals, and loops to your workflows, making them dynamic and responsive to data. Use them to run different steps based on conditions, process items in bulk, or control timing.
The following flow control steps are available:
- Conditional execution (
if): Run different steps based on boolean or Kibana Query Language (KQL) expressions - Loops and iteration (
foreach): Iterate over arrays or collections - Execution control (
wait): Pause step execution for a specified duration
The if step evaluates a boolean or KQL expression and runs different steps based on whether the condition is true or false.
steps:
- name: conditionalStep
type: if
condition: <KQL expression>
steps:
# Steps to run if condition is true
else:
# Steps to run if condition is false (optional)
Refer to If for more information.
The foreach step iterates over an array, running a set of steps for each item in the collection.
steps:
- name: loopStep
type: foreach
foreach: <array expression>
steps:
# Steps to run for each item
# Current item is available as 'foreach.item'
Refer to Foreach for more information.
The wait step pauses workflow execution for a specified duration before continuing to the next step.
steps:
- name: waitStep
type: wait
with:
duration: "5s"
Refer to Wait for more information.