Skip to main content
Loop action step

The use and options of the Loop step in Actions.

Updated over a month ago

After reading this article, you’ll know the following:

  • Loop action step and its functionality

  • How to use this step in your application

What is Loop step?

Loop action step in a function that allows users to iterate over arrays, a collection of records stored under a single variable within their application workflows. This enables the execution of repeated actions for each record in an array, reducing the need for repetitive manual operations.

Loop step icon

Loop action step is best used in scenarios where you need to perform a set of actions on multiple items. Common use cases include processing lists of records, sending personalized emails to a list of recipients, or applying updates to a batch of records.

For example, you must send thank-you emails to customers who purchased items in the last 24 hours. You fetch the list of customers, then use a Loop action step to iterate through this list. For each customer (iterator name ‘customer’), a Send email action step sends a personalized email automatically.

Variable options

Array: An array is a collection of items (records) stored in a single variable, often used to hold lists of data such as numbers, strings, or objects. Each item in an array can be accessed using its index, representing its position in the collection.

Iterator name is a name under which the value of each iterator will be available. It represents each individual record in the array as you loop through it.

Auto batched collection automatically paginates the collection in chunks when used in a loop step. We advice to use this option when working with big amounts of data.

Enabling this option will disable the index option as it would cause to slow down the processing of big amounts of data. To enable indexing on big amounts of data, use the 'index values' option on your model level.

Index is the variable that holds the current position in the loop, starting at 0. For example, in the first iteration, the index is 0; in the tenth iteration, the index is 9. It helps you know which item you are processing at any given time, and it is useful when working with a lot of records.

Loop step options

Using Loop step

Imagine you have an application with a button that allows users to delete all their saved records (e.g., a list of saved articles). To handle this action efficiently, you’ll use a Loop step before a Delete step to ensure all records are deleted properly.

  1. Create a new action in your application and make sure you’ve created a new action variable. It’s the collection variableid’ that will fetch records to be deleted.

Start step

2. You then drop a Loop action step to iterate through the ID collection.

  • Array: id (the list of collection IDs to delete).

  • Iterator name: article_id (used to loop through each record in the collection).

  • Index: index_art (keeps track of the current position in the array, starting from 0).

Loop step options

3. After saving your Loop step settings, drop the Delete record step in the Loop and configure it:

  • Record: Pick up a yielded variable created in the Loop step (article_id)

  • Result: capture the outcome of each deletion (deleted_art)

Configuring the Delete record

Using the Loop step before the Delete record ensures that every article in the array is deleted systematically. Without it, you would have to manually specify each delete action, which is impractical and almost impossible for large numbers of items. The Loop automates this process.

Processing large volumes of data

When working with large amounts of data, we advise working in batches. You can either create a manual batch set by using sub-actions to set up batches; more about that can be found here.

When working in a manual flow of batches, you have more customizability options, however, this will also limit your collection processing to the data API limit of 200 records per set.

In situations where you want to work with bigger batches of data, toggle the Auto batched collection functionality when creating the collection you want to work with.

This will automatically batch your data while processing it through your loop step, allowing bigger sets to be passed through.

The auto-batched collection feature limits to 5000 records per batch and can be lowered if a batch is too large to load within the data API time limit.

Did this answer your question?