Skip to content

Loop

How-to7 minExpert

Before you start

A Loop runs the same steps once for every item, such as every line of a purchase order. It has two paths: Each item holds the steps to repeat, and After loop continues when the last round is done.

Use a Loop to do one thing per record: email each vendor, update each line. For a bulk save, a Record manager with Batch create or Batch update is faster than a loop.

  1. Make the list first. Add a Load data step above and name its list, for example openOrders.
  2. Click + and choose Loop.
  3. Under Repeat for, choose Each record in a list.
  4. Under Which list?, choose the list.
  5. Click + on the Each item line and add the steps to repeat.

Inside the loop, the list’s name means the current record. In Insert data it shows as Current item in the list’s name.

A Loop step selected, with the Repeat for cards on the right and two paths on the canvas, Each item and After loop.
    Repeat for offers three ways to loop.
    Which list? shows the lists made above this step.
    Each item holds the steps that repeat.
ChoiceWhat it doesSetting
Each record in a listOne round per record of a list made aboveWhich list?
Each item inside a fieldOne round per item of a list field on the current record, such as the lines of an API replyWhich field?
A number of timesRounds count from 1 to NHow many times?, Name this index

For A number of times, the count is a Smart Script or a number. Decimals are cut, and 0 or less means no rounds. Read the round number as the name you gave, then index.

Turn on Process in pages. It applies to a list made by Load data. With paging on, the loop reads the list from the database one page at a time.

SettingWhat it does
Page sizeRecords per page. Leave it empty for the standard page
Stop afterTotal records to process. Leave it empty to process them all

Sara loads the vendors whose contract ends this month into expiringVendors. A Loop goes over that list. In Each item, a Send email addresses the current vendor’s contact. After the loop, a Record manager marks the batch as notified.

  • Save what you need from a loop over records with a Record manager inside the loop. A loop that counts keeps what its rounds made.
  • A Terminate inside the loop ends the whole workflow.
  • Make the list in a Load data step on the same path above the loop.
  • Put a Record manager with Batch create or Batch update before or after the loop, so the list is saved once.

Check yourself

Karim loops over a list made by Load data and needs a result after the loop. How does he keep it?
Show the answer

Save it inside the loop with a Record manager. Save what you need from a loop over records with a Record manager inside it.

Which path of a Loop holds the steps that run once per item?
Show the answer

Each item. Each item holds the repeated steps. After loop continues once the last round is done.

What's next

Last checked