Looper
Looping over lists, dicts and arrays
The Loop Helper is one of the most powerful ones and at the same time, one of the easiest to setup. It allows you to loop over lists, list of dictionaries (a.k.a. dicts) and arrays and perform (execute) an action multiple times or in other words for each entry of the the list, dict or array. The simplest use-case is you get 10 contacts from Zendesk or a CSV file and want to create a new ticket in Zendesk for each of the 10 contacts.

As displayed below, it is connected after any particular step and configured connecting the previous, incoming arrow from above to it. The outgoing already present arrow to the right, having the word "ActionLoop" associated to it (don't change this or it will break), is connected with whatever action you want to be done several times.
The iterate over action loops over a pre-defined list.
The Loop configuration in the right hand connecter panel is done by starting with the RefID, zend1, and connecting it with a period . and then the adding the object name where the list can be found, in this case, users. In other words. The first step of the flow returns a JSON containing the a list of users which are wrapped in "users" as a list. This can loop like this:
{
"users": [
{user1 ... some more JSON},
{user2 ... some more JSON},
{user3 ... some more JSON}
...
]
}
By passing the loop "zen1.users" it knows that it should get a list within "users" and passes {user1 ... some more JSON}, {user2 ... some more JSON},
{user3 ... some more JSON}
... to the next step "zen2" on.
The iterate over action loops while (until) a to be defined condition is matched; usually e.g. until there are no more pages to loop over.
The condition is always checked at the end of each loop iteration, so that you can also reference to steps that happen inside the loop, which are not yet available at the beginning of the first iteration.
Run while the index is smaller than 10:
index < 10
This loop will have 11 iterations, because
index
starts at 0
and the condition is checked at the end and not the beginning of each loop iteration.The iterate while loop has a maximum of 1000 iteration for capacity protection. If you need to increase this limit, please raise a support ticket.
It is possible to loop over multiple objects, e.g. over a list of companies (
loo1
) then over each employee (loo2
) then over each ticket of an employee (loo3
). Just make sure, you reference correctly in the subsequent branches of the loop.Using the same reference inside a Looper as the Looper Helper itself does not work as expected, as the Looper Helper's reference will alway have priority, while the Looper is running, and thus any other step with the same reference inside the loop will never be considered.
Last modified 1yr ago