If-conditions, looped actions, and branching logic.
==
, >
,in
) in the functions cheatsheet.If condition / Loops
tab, you can specify a condition that determines whether the action should be executed.
For example, to run the Get result
action only if the URL submission was successful, go to the If condition / Loops
tab and specify the following in the Run if
input:
&&
and ||
operators:
all
or any
of the upstream actions succeed or fail.
Configure this by going to the If condition / Loops
tab of the joining node and setting the join_strategy
option to all
or any
.
If condition / Loops
tab, you can specify loop expressions to iterate over a list of items and run the action for each item.
ACTIONS.some_intel_feed.result.data.malware_samples
or a list of items received via webhook in TRIGGER
.Define the loop
${{ for var.some_variable_name in some_list }}
syntax.
The variable name can be anything you want, but we recommend using a name that makes sense for the items in the list.In this example, we iterate through a list of numbers send via webhook in TRIGGER
.Use the loop variable
Inputs
tab.
You can now use the loop variable in the action’s inputs using the ${{ var.some_variable_name }}
syntax.
During the workflow run, each var.some_variable_name
in the loop expression is replaced with the current item in the list.In this example, we use the loop variable in core.transform.reshape
action to iterate through a list of numbers and add one to each number.Run workflow
{"numbers": [1, 2, 3]}
to see the loop in action.The core.transform.reshape
action will be executed three times with var.number
being 1
, 2
, and 3
respectively and the output will be [2, 3, 4]
.