Documentation
Contents

Cancel

Recommended Articles

  1. unify-apps

    IMAP

    Unify Integrations

    Integrate your app with IMAP to enable seamless email synchronization, real-time access, and enhanced communication workflows.

  2. unify-apps

    Preview Your Work

    Unify Automations

    Effortlessly review & monitor your automation’s performance

  3. unify-apps

    FTP/FTPS

    Unify Integrations

    Connect your app with FTP/FTPS to automate secure file transfers and streamline data exchange across systems.

  4. unify-apps

    Snowflake

    Unify Automations

    Connect to Snowflake for fast, scalable cloud data warehousing and analytics

  5. unify-apps

    Button

    Unify Applications

    Create interactive elements with ease using buttons

  6. unify-apps

    BambooHR

    Unify Automations

    Integrate your app with BambooHR to streamline HR management, automate employee data processing, and enhance onboarding workflows

  7. unify-apps

    Build your first automation

    Unify Automations

    Learn how to build your automation step by step

  8. unify-apps

    User Management

    Unify Applications

    Efficiently manage user roles and permissions

  9. unify-apps

    Microsoft Teams

    Unify Automations

    Connect your app with Microsoft Teams to enhance communication, automate workflows, and foster collaboration across your organization

  10. unify-apps

    Jira

    Unify Automations

    Use Jira to plan, track, and manage your agile and software development projects

  11. unify-apps

    Google Calendar

    Unify Automations

    Integrate your app with Google Calendar to streamline scheduling, automate event management, and improve team coordination

  12. unify-apps

    SAP HANA

    Unify Integrations

    Connect your app with SAP HANA to leverage in-memory computing for real-time data processing and advanced analytics at scale.

  13. unify-apps

    Encoding

    Unify Data

    Convert data effortlessly with advanced encoding

#
Unify Automations
Logo
Use Operators
Logo
Loop

Loop

Logo

6 mins READ

Overview 

Loop allows you to repeat a set of steps based on different criteria.

There are primarily two categories of loops:

While Loop: This type of loop repeats the set of actions as long as a specified condition remains true. Once the condition becomes false, the loop terminates automatically.

For example, you can retrieve the data from a CSV file while the number of records has reached a certain limit, such as not more than 100 records.

For Loop: A for loop iterates over a list and executes a set of actions for each element within that list. The loop concludes once all elements have been processed.

For instance, a for loop could be used to extract data from each record in a CSV file.

Image

Use Case

Let's look at an example where we will download a list of image URLs individually and upload them to our Amazon S3 server.

  1. First, we have our list of image URLs and then pass it to Loop using “for loop” for every URL present in the list.

    Image
    Image
  2. Then, we use Files by UnifyApps to download the image files one after the other from their URLs and create a file object out of them.

  3. Finally, we pass it to the Amazon S3 node, allowing us to upload the images to our server.

For Loop

This action allows users to execute repetitive tasks by iterating through each item in a list and performing specified actions on each of them in the sequence.

Users can choose to execute a single item at a time or process items in batches.

Image
Image
Thumbnail

Note

When batch execution is selected, users must specify the batch size, with a maximum limit of 100 items per batch.

Image
Image

Input Fields

Description

List Source

A data structure that holds a collection of items.

Repeat Mode

Type of For loop execution: single item or in batches.

While Loop

This action allows users to execute a logic block if a specified condition remains true.

Users can apply conditions through the input pane and can add multiple conditions.

Image
Image

Input Field

Description

Condition

Logical expression that evaluates to True or False.

Add Condition

Add multiple conditions.

Add Condition Group

Conditions can be grouped with AND or OR.

Thumbnail

Note

We can create hierarchies of loops by nesting them one after other to handle diverse automation scenarios effectively.

Combine Loops

You can combine While and For each Loop in the same automation.

For example, a recipe can contain a For loop inside a While loop. Following example supports the above use case:

  • REPEAT search for contacts using SOQL query in Salesforce WHILE pages of search results remain.

  • FOR EACH record in a page of search results, retrieve contact details.

    Image
    Image

FAQs

How many times can a loop iterate in a single run?

A loop can have a maximum of 100000 iterations in a run.

Why are loops in test runs stuck in progress after some iterations?

In test runs, the execution lasts for a maximum of 10 seconds. If it exceeds this duration, the process stops, so some runs may still appear to be in progress.

What is 'Repeat Mode' in a For loop?

Repeat Mode allows users to choose the iteration type, either processing a single item at a time or processing items in batches.