Flow control steps
Flow control steps allow you to add logic, conditionals, and loops to your workflows, making them dynamic and responsive to data.
The following flow control steps are available:
- Conditional execution (
if): Execute different steps based on boolean or Kibana Query Language (KQL) expressons - Loops and iteration (
foreach): Iterate over arrays or collections - Execution control (
wait): Pause execution for a specified duration
The if step evaluates a boolean or KQL expresson and executes different steps based on whether the condition is true or false.
steps:
- name: conditionalStep
type: if
condition: <KQL expression>
steps:
# Steps to execute if condition is true
else:
# Steps to execute if condition is false (optional)
Refer to If for more information.
The foreach step iterates over an array, executing a set of steps for each item in the collection.
steps:
- name: loopStep
type: foreach
foreach: <array expression>
steps:
# Steps to execute 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.