Loops
A loop repeats a section of your Wrkflow, processing items in order, one at a time within that loop. You can loop through a list, such as orders returned by an API, or a range of numbers, such as page numbers.
Each lesson combines a short video, a copyable Wrkflow, key settings, and checks for the expected result. If you are new to loops, start with JSON array loops and follow the lessons in order.
Choose a pattern
| Lesson | Use it when |
|---|---|
| 1. JSON array loops | You have one list and want to process each item in order. |
| 2. Number range loops | You want to repeat steps for each number in a range, such as requesting API pages. |
| 3. Nested loops | You need to finish processing each page's items before requesting the next page. |
| 4. Back-to-back loops | You want to finish one loop, perform any intermediate work, then start another loop. |
The first three lessons use movie quotes from an API as sample data. Back-to-back loops uses two small lists included in the template, with no API connection needed. The patterns apply equally to orders, contacts, tickets, or other records.
The loop pair
Each loop uses two Wrk Actions: Loop through JSON array or Loop through number range, paired with Continue loop. Connect the last step inside the loop to Continue loop, then connect its Continue outcome back to the loop Wrk Action. Its Exit outcome leads to the steps that run after the loop finishes.
Two mappings connect the pair:
- The loop Wrk Action's Loop ID goes into Continue loop.
- Continue loop's Continue loop ID goes into the loop Wrk Action's configuration.
The Continue loop ID input is optional so a Loop Through Wrk Action can start a fresh loop. To advance through subsequent items, configure the return mapping from Continue loop. In the nested example, one inner Loop Through Wrk Action starts fresh with this input blank, and a second resumes the same loop with the input mapped.
Each logical loop needs its own matching Continue loop, including loops used inside or after another loop. Keep each loop's IDs paired correctly.
Loops or divides?
Use a loop when processing order matters or several Wrk Actions need to run for each item. Divides process independent items in parallel within a dividing Wrk Action. You can combine them: a loop requests API pages in order while a dividing Wrk Action processes the rows on each page.
Use loops when steps need to reuse the same browser session. Parallel divided work is a poor fit for Wrkflows that depend on shared browser session state.