website logo
⌘K
Explore our documentation
Contact APIANT support
What is APIANT?
Automation Editor
Key Concepts
Account Management
Managing Automations
App Connections
Building Automations
Alert Mappings
Troubleshooting
CRMConnect: Mindbody → HubSpot
CRMConnect: DonorPerfect → HubSpot
CRMConnect: DonorPerfect → ActiveCampaign
MailConnect: DonorPerfect → Mailchimp
ShopConnect
ShopConnect Settings
Sync Products
Manually sync Mindbody services/pricing options to Shopify
How to tag products in Shopify to prevent sync during sales sent to Mindbody
Retrying orders from Shopify → Mindbody
Manually pushing Mindbody orders to Shopify
Mindbody Pricing Discontinuation: Integration with Shopify
Guide to manually syncing Mindbody Packages with Shopify Products
Features that are not supported in ShopConnect
Automation Alert Reports
Linked Accounts
ZoomConnect
New features in version 4
Settings
General
Email & SMS
BOTs
MINDBODY
Zoom
ZoomConnect Mindbody Appointments - Setup and requirements
Troubleshooting
Assembly Editor
Key Concepts
Account Management
API Key Management
Managing Content
Building Assemblies
API Integrations
Other Assembly Types
Keyvalue Storage
Assembly development cycle
APIANT for Integrators
Help Forum
Automation Templates
Development Server
Module IDE
Shared App Connections
Tenants and Linked Accounts
APIANT Inline
Supported functionality
Embed Inline
Sandbox
Docs powered by
Archbee
Automation Editor
...
Building Automations
Action functionality

Loops

5min

Automation loops do not function in the same manner as traditional programming loops!

If you are accustomed to programming loops, read this section carefully to understand the differences.

Automation loops provide a mechanism for iterating through arrays of data values. A common example is the line items within an order.

Automation loops are unlike programming loops in that there is no variable with a starting value being incremented until an ending value or criteria is met.

Let's walk through a simple loop as an example. We will use this action to emit an array of 3 values consisting of 'first', 'second', and 'third':

Document image


Loops are added by clicking on a "plus" icon and choosing the option:

Document image

Document image


Click the action field and select the action whose output will be looped upon:

Document image


Within the loop we'll just convert those three array elements to uppercase with this action:

Document image


The input value to uppercase will be the array output from the first action:

Document image


When the automation runs, the loop makes 3 iterations and uppercases the output from the first action:

Document image


The scope of the loop is the selected action, which the loop investigates at runtime to determine the biggest array emitted. The loop then iterates that many times, once for each element of the largest array. For each iteration of the loop, any mapped array fields are accessed in succession.



A common source of trouble is if other actions having array output are mapped to items within the loop. If those mapped actions emit arrays that are mapped then the automation execution engine also processes them in the same manner when field mappings are substituted. But if the other actions have larger arrays than the loop's selected action, those extra array elements won't be processed. So always remember that the largest array emitted by the loop's selected action is what controls the loop's number of iterations and the subsequent mapping of array elements.

Loops can contain conditional branches and other nested loops as needed:

Document image




Updated 03 Mar 2023
Did this page help you?
PREVIOUS
Conditional branches
NEXT
Break loop
Docs powered by
Archbee
Docs powered by
Archbee