Locoia
  • Overview
  • Account and User Settings
    • User types
    • Adding Users
    • Teams
    • Access Permissions
    • 2 Factor Authentication 2FA
    • Versioning and Snapshots
    • Activity Log
  • Reset your Password
  • Invoices and Payments
  • Automation
    • Flow Builder
      • Flow Building Best Practices
      • Jinja Template Language
        • Jinja: (Custom) variables, wildcards and functions
        • Magic Code Samples
      • Connectors & APIs
        • Titles and References
        • Referencing data of objects, lists, arrays - how to pass data dynamically
        • Accessing Objects with JSONPath
        • Merging nested JSON objects
        • Parsing JSONs from String
        • Response Headers & Status Codes
        • Custom Data Fields
        • Wildcard API calls and actions
        • Response cleaning
      • Text Strings, Date & Time, Numbers and Currencies
        • Text and Strings
        • Dates & Time
        • Numbers (Thousand Separators, Currencies)
      • Email-formatting
      • Code Fields
      • Running single Flow steps
      • Flow run data retention, logging, and error notifications
      • Advanced View
      • Dynamic Title
      • Custom Error Handling
      • Error Handling Flows
      • Automatic Pagination
    • Flow Debugger
      • Automatic Retrying
      • Run Flows again
      • Troubleshooting Flows
    • Community Library
  • Connectors & Helpers
    • Connectors
      • Monday.com
      • ActiveCampaign
      • Aircall
      • Allthings
      • Amplitude
      • Animus
      • Assetti
      • Awork
      • AWS RDS Database - How to connect
      • bubble.io
      • Casavi
      • Chargebee
      • CleverReach
      • comgy
      • commercetools
      • Everreal
      • Exact Online
      • Facebook Marketing
      • Fahrländer Partner
      • FastBill
      • FILESTAGE.io
      • Freshdesk
      • Freshsales
      • Google Ads
      • Google Ads Lead Form
      • Google Analytics
      • Google Chat
      • Google Drive
      • Google Sheets
      • Gmail
      • HubSpot
      • Heyflow
      • iDWELL
      • ImmobilienScout24
      • Instagram Ads
      • Intercom
      • klaviyo
      • Kiwi Opening Doors
      • Klenty
      • Klipfolio
      • Kolibri CRM
      • konfipay
      • KUGU
      • Shopify
      • S3 AWS
      • SQS AWS
      • Lambda AWS
      • Learnster
      • lexoffice
      • LineMetrics
      • Linkedin
      • Locoia
      • Notion
      • MailGun
      • Makula
      • Microsoft Dynamics 365
      • Microsoft OneDrive
      • MixPanel
      • MongoDB
      • Odoo
      • OnFleet
      • OnOffice
      • Oracle NetSuite
      • Outbrain
      • Quickbooks
      • Trello
      • PandaDoc
      • Personio
      • Pinterest Ads
      • Pipedrive
      • Plentific
      • PriceHubble
      • relay
      • REALCUBE
      • Sage ERP
      • Salesforce
      • SAP
      • Scoro
      • Seafile
      • sevDesk
      • SharePoint
      • SharpSpring
      • Slack
      • Snapchat Marketing
      • Snowflake
      • Teamleader Focus
      • Teamwork.com
      • Tableau
      • TikTok
      • TinQwise
      • The Trade Desk
      • Twitter
      • Typeform
      • WordPress
      • Xero
      • Youtube
      • Zendesk
      • Zoho CRM
      • Zoom
    • Helpers
      • Scheduler
      • Webhook
      • Dict Helper
      • Spreadsheet Helper
      • REST Helper
      • Boolean Helper
      • Multi Case Helper
      • Looper
      • FTP Helper
      • CSV Helper
      • XLSX Helper
      • Mail Sender
      • Flow Trigger
      • File Storage Helper
      • Terminate Helper
      • Delay Helper
      • SQL Connector
      • PDF Helper
      • Zip Helper
      • Data Warehouse Helper
      • XML Helper
      • Form Helper
      • Arrow
      • Error Arrow
    • Authentication Types Available
      • Setting up authentication
      • OAuth1
      • OAuth2
      • Refreshable token
      • AWS Signature
      • Basic Auth and Other Simple Authentication Methods
      • How are API versioning and API updates handeled?
      • Custom OAuth2 clients (apps)
    • Building Connectors
      • Base Connector Setup
        • Connector Auth Validation
        • GraphQL APIs
        • Rendering with User Input
      • Building Connector Actions
        • Actions Examples
      • Search Automation
      • Pagination Automation
      • Uploading Files in Actions
      • Working with SOAP APIs
    • Super Actions
    • Webhook Trigger for Connectors
    • Data Mapping and Env Variables
  • Embed - White Label Portal
    • Embed Overview
      • 1. Embed Flow
        • 1.1 Creating Embed Flows
        • 1.2 Updating Embed Flows
        • 1.3 Embed Error Handling
        • 1.4 Setting up Callbacks for Integration activation/deactivation
        • 1.5 Setting up Remote search
        • 1.6 Setting up End User logs
      • 2. Configure Embed
        • 2.1 Embed Integration via SSO
        • 2.2 Proprietary connector setup
        • 2.3 Sharing level
        • 2.4 Consent screen
        • 2.5 Account Secrets
        • 2.7 Further settings
      • 3. Integrate Embed
        • 3.1 iframe vs native embed
        • 3.2 Customizing CSS
        • 3.3 Events emitted from iframe to parent window
      • 4. Embed for End User
        • 4.1 Embed Remote Search
        • 4.2 Embed End User Logs
      • 5. Test Embed Configuration
        • Testing example
      • 6. Embed Integrations and Connector Auths
    • Embed FAQs
  • Data and Dashboards
    • Dashboards & Insights
      • Introduction to Dashboards
      • Introduction to Insights
      • Introduction to Data Sources
      • Dashboard Filters
      • Insight Marketplace - Using Pre-Built Insights
      • Writing SQL Queries
      • Useful SQL Examples
      • Charts
        • Line Chart
        • Bar and Horizontal Bar Chart
        • Stat Card
        • Pie Chart
        • Gauge Chart
        • Donut Chart
        • Stacked Bar, Horizontal Stacked Bar, and Normalized Horizontal Stacked Bar
        • Multiple Line Chart
        • Pivot Table
        • Map Chart
  • Best Practice Guides
    • Integration Best Practices
    • Integration Check List
    • CSV Files in Excel
    • Multi-Tenant Flows
    • On-Premise Integrations
    • Database Connection Setup
    • Data and General Security
    • Using Tags
    • FAQ
  • API
    • Locoia API Authentication - Personal Access Token
    • Create Connector Authentication
  • Contact us
  • Status of Service
  • Data Privacy
  • Imprint
Powered by GitBook
On this page
  • Overview
  • Actions
  • 1. Iterate Over Loop
  • 2. Iterate While Loop
  • Example
  • Action Loop arrow
  • Nested loops
  • Run certain iteration
  • Referencing Behavior
  • Run iterations in parallel

Was this helpful?

  1. Connectors & Helpers
  2. Helpers

Looper

Looping over lists, dicts and arrays

PreviousMulti Case HelperNextFTP Helper

Last updated 7 months ago

Was this helpful?

Overview

The Loop Helper is one of the most powerful Helpers and at the same time, one of the easiest to setup. It allows you to loop over , a list of and arrays and execute an action multiple times (each entry of the list, dict or array).

Actions

1. Iterate Over Loop

The Iterate Over action loops over a pre-defined list.

Let's use an example: Imagine you want to send emails to each user you get from the Get Contacts step that returns a list of contacts:

List of contacts
[
  {"id": 123, "email": "john.doe@mail.com"},
  {"id": 456, "email": "peter.gragory@mail.com"},
  {"id": 789, "email": "richard.hednricks@mail.com"}
]

2. Iterate While Loop

The Iterate Over action loops while (until) a 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 steps that happen inside the loop, which are not yet available at the beginning of the first iteration.

Example

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 at the beginning of each loop iteration.

The iterate while loop has a maximum of 1000 iterations for capacity protection. If you need to increase this limit, please raise a support ticket.

Action Loop arrow

It is necessary to link the ActionLoop arrow in the Looper Helper to the steps that will be executed during each iteration.

The Looper Helper is associated with the pre-created arrow named ActionLoop, so don't change it or it will break.

Nested loops

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.

Keep in mind that {{index}} always refers to the current loop. In a nested loop, {{index}} will always reflect the index of the innermost loop. If you need to reference the index of an outer loop, you must store that index explicitly in a variable (using a "Dict Helper" step or a similar approach) before entering the inner loop. This allows you to safely access the outer loop's index while iterating through the inner loops.

Run certain iteration

The Looper runs all iterations by default, but if working with complex flows and if waiting for results is time- or resource-consuming, you can also run a selected iteration, when using Single Flow Step runs.

When running the entire Flow, the Looper will run all iterations, no matter what iteration index is set.

Referencing Behavior

Using the same reference inside a Looper as the Looper Helper itself does not work as expected, as the Looper Helper's reference will always have priority, while the Looper is running, and thus any other step with the same reference inside the loop will never be considered.

Run iterations in parallel

The "Run Iterations in Parallel" feature is designed to accelerate flow execution by processing items in batches of 10 concurrently. After completing the first batch, the Looper moves on to the next batch of 10 items (or the remaining number).

Key Aspects of the Parallel Looper:

  • Sorting:

    The output in the step's debugger will be sorted by start date, so steps from later iterations might appear before those from earlier iterations.

    • Currently in development: Sorting of the final output of the Looper according to the iteration indexes and then start date (so that different iterations are not mixed in the Flow Debugger)

  • Each step in the Looper can have its own error handling:

    • Terminate flow: If a step fails with this error handler, no further iterations will be scheduled. However, already scheduled iterations will continue to execute.

    • Skip loop iteration: This error handler skips the current iteration but allows the Looper to continue processing other iterations.

    • Break current loop: This causes the Looper to exit the current loop iteration but does not affect others.

    If multiple errors occur with different handlers, the most severe one dictates the outcome:

    • For example, if multiple steps fail and use different error handlers (e.g., one step uses Skip loop iteration, another uses Break current loop, and a third uses Terminate flow), the "worst" status wins. In this case, the Looper will terminate with an error, and flow execution will not continue.

  • Completion of Running Iterations:

    • If an error occurs that requires stopping further iterations (like "Terminate"), the Looper will not schedule any more batches.

    • However, all currently running iterations will be allowed to complete. For example: if an error happens on the 3d iteration, the Looper will finish the remaining iterations from the current batch

Select the Action type Iterate Over and input get_contacts to the Loop Reference. In the send an email to each user by accessing the email property with the Jinja expression {{get_contacts[index].email}}

:

Custom Error Handling
Action Loop
lists
dictionaries
Iterate Over example
Set iteration index