MESA Docs
MESA Homepage
  • Welcome to MESA
    • Installing MESA
    • Dashboard
    • Core Concepts
    • Getting Help
  • Templates
    • Template Library
    • Installing & Editing
  • Workflow Builder
    • Triggers
    • Actions
    • Fields
      • Variables
      • Formatting Variables
      • Liquid Templating
    • Testing
  • Workflow Activity
    • Tasks
      • Troubleshooting
      • Replay
    • Logs
    • Time Travel
  • Best Practices
    • Set Titles & Descriptions
    • Track Time Saved
    • Enable Failure Notifications
    • Avoid Infinite Loops
  • Going Further
    • Plans & Billing
    • Notifications
    • Credentials
    • Understanding the Queue
    • Export & Import Workflows
    • Platform Thresholds & Limits
  • Built-in Tools
    • Activity Log
    • AI
    • API
    • Approval
    • MCP
    • Custom Code
      • Libraries
        • MESA SDK
        • Filter
        • Loop
        • Transform
        • oAuth
        • Shopify
        • ShopifyGraphql
      • FAQ
    • Data
    • Delay
    • Email
    • Filter
    • Form
      • Configure
      • Going Further
      • Technical Notes
    • FTP
    • Image
    • Loop
    • Package Tracking
    • Paths
    • Schedule
    • Scraper
    • SMS
    • Transform
    • Virtual Output
    • Weather
    • Web Request
    • Webhook
  • Apps
    • Airtable
    • Amazon S3
    • Asana
    • Blog Studio
    • ChannelApe
    • Claude
    • ChatGPT
    • Dall-E 2
    • Delighted
    • Digital Humani
    • Discord
    • DocuSign
    • Dropbox
    • Etsy
    • Facebook
    • Fera.ai
    • Gatsby
    • Gmail
      • Send Email
    • Google Analytics 4
    • Google Analytics UA
    • Google Calendar
    • Google Drive
    • Google Forms
    • Google Sheets
      • Add Row
      • Query Rows
      • Update Row
      • Row Created
      • Row Updated (Advanced)
      • Creating New Spreadsheets
      • Technical Notes
    • Gorgias
    • Govalo
    • Help Scout
    • Hubspot
    • Infinite Options
    • Intercom
    • IPDetective
    • Judge.me
    • Katana
    • Klaviyo
      • API Deprecation
    • Loop Returns
    • Loyalty Lion
    • Mailchimp
    • Mailgun
    • Mandrill
    • Mantle
    • Notion
    • Odoo
    • Omnisend
    • Page Studio
    • Pinterest
    • Printful
    • PrintNode
    • QuickBooks
    • Rebuy
    • Recharge
    • Remove.bg
    • Returnly
    • Rivo
    • Salesforce
    • Segment
    • Sendlane
    • Shippo
    • ShipStation
    • Shopify
      • Technical Notes
        • Configuring Your Payload
        • Modifying and Filtering Get Lists
        • Parameters
        • Error Codes
        • Accuracy of orders_count Variable
        • Accuracy of Count Products Action
        • Using the Gift Cards API
        • How to Find a Specific Record in the Testing Interface
        • Order, Customer, and Product Updated Trigger Frequency
    • Shopify Flow
    • Shopify Plus
    • Shopify Retail POS
    • Skio Subscriptions
    • Slack
    • Smartrr
    • Smile.io
    • Square
      • Updating Inventory
      • Frequently Asked Questions
    • Stamped.io
    • Stripe
    • Thanks.io
    • TikTok
    • Tracktor
    • Twilio
    • Uploadery
    • Wonderment
    • Xero
    • Yotpo
    • Yotpo Loyalty
  • For developers
    • Admin API
    • Command Line Interface
    • Embedding templates
  • Frequently asked questions
    • Why isn't the log search returning logs with the search I entered?
    • Is it possible to handle errors or retry steps?
    • How do I handle a failed task?
    • Does MESA auto-save workflows?
    • Can I Use Apps That Don't Have a MESA Connector?
    • Why is my workflow action adding the same data each time it occurs?
    • How do I cancel automations that are already in progress?
    • How do I cancel my MESA subscription or 7-day trial?
    • Can you import code from npm in custom code?
    • Do you have a Slack Community?
Powered by GitBook
On this page
  • Configure
  • Loop
  • Loop End
  • Going Further
  • Using Loop End variables
  • Other kinds of Loop steps
  • Technical Notes

Was this helpful?

  1. Built-in Tools

Loop

PreviousImageNextPackage Tracking

Last updated 5 months ago

Was this helpful?

The Loop tool allows you to iterate over a list of items one-by-one.

A Loop is useful when you want to take a list of things, for example, all of the line items in an order, and perform an action on each individual item.

Configure

Loop

To iterate over specific items from a list (typically from the or ), use the menu to select the list of items after adding your Loop step.

After your Loop has been added and configured, you'll see Loop and Loop End steps within a confined container with a grey border.

You can reference the individual items or their information by using the Loop variables that will populate for actions added in between the Loop and Loop End steps.

You will have variables available from steps that occur prior to the Loop in your workflow, as well as the Loop variables. Typically, you'll want to use Loop variables when configuring actions between the Loop and Loop End steps.

Be sure to Save your workflow after adding and configuring your Loop to see your available Loop variables.

In the Configure menu of each Loop action there are conditions you can add to filter the list.

Loop End

The Loop End step signifies the end of the Loop.

Actions added after the Loop End step will only run once.

Going Further

Using Loop End variables

The default configuration of the Loop End step is to continue the workflow without passing variables after the Loop. However, you can optionally configure the Loop End step to use Loop and Map Value.

The variable that's created from the Loop End step will be Loop End > Items, and it can be used in steps after the Loop.

Other kinds of Loop steps

Beyond the regular Loop action, you can add different variations of Loop actions to your workflow. These are single-output steps with a different behavior than the Loop & Loop End functionality.

Sum

The Loop Sum action will calculate the sum of all items that match a specific criteria.

For example, the Loop Sum action can add up the price of line items (products) in an order and pass that value as a variable to reference in the following steps. The value will be an integer.

Optionally, you can customize the sum operation by clicking Edit Code link and going into the code.

In the code editor, you can change the sum line.

Map

The Loop Map action will create a list of values that are identified based on the item you're referencing from a previous step.

For example, the Loop Map action can pass all line item (product) titles in an order for tagging purposes.

Number of Matches

The Loop Number of Matches action will return the number of items that match a specific criteria.

For example, the Loop Number of Matches action can provide an integer as a variable that can be referenced in future steps representing the number of line items (products) in an order with a specific SKU.

Technical Notes

  • The Loop queue is synchronous.

  • There is a legacy version of the Loop step that can be found on stores with previous versions of MESA, or when using templates that have not been updated to the latest Loop and Loop End functionality.

    • Everything gets enqueued all at once with legacy Loop actions, which makes this action more susceptible to timeouts.

To perform one or more tasks on each item in the list, add between the Loop and Loop End steps.

You can populate the via the More options button so that specific values or results that meet the conditions are passed to the following steps.

In the Configure submenu of the Loop End step, click the More options button to add Loop End Behavior to the step. After that, click the Loop and Map Value radio button and select a value to return in the field via the selector.

The value can be a single variable from an action within the Loop, or you can add a action within the Loop and map a new object.

actions
Filter by conditions
variable
Transform Mapping
Trigger
Actions
variables