Skip to main content
Loop action step

The use and options of the Loop step in Actions.

Updated yesterday

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.

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.

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.

Did this answer your question?