Lists, loops and data in a workflow
Before you start
While a workflowWorkflowAn automation: trigger plus steps, run per module; also called "flow" on the home page.Open glossary ↗ runs, it holds one record, the one that started it, and any number of named lists of other records. Every step can read what the workflow holds at that point. Knowing which of the two a step is reading is most of the skill.
- Load data
- List holds records
- Loop: each item
- Step reads the item
vendorProfile.Where does a workflow’s data come from?
Section titled “Where does a workflow’s data come from?”- The record that started it. For a record trigger, this is the record that was saved, with its current values. For a scheduled workflow there is none.
- A list from Load data. The step finds records of any module and keeps them under a name you choose.
- A list from a JSON parser, a CSV parser or a Loop that counts. A JSON parser turns the body of a webhook or a text field into data. A CSV parser reads the rows of a file. A Loop that counts makes a list with one record whose field
indexis the round number.
Steps use data through the Insert data picker, which lists the record and every list the step can reach. Beezr writes the reference for you, as a token in the form $table$.$field$. Smart Script, the language behind Beezr’s scripts and conditions, reads the same tokens. See Smart Script.
How does a step read a list?
Section titled “How does a step read a list?”A list is a set of records. A step that reads one field of it gets the value from the first record. The picker shows it as the list name, an arrow and the field, for example vendorProfile › Email.
Sort decides which record is first. Without a sort, records come oldest first. So choose a sort when you want the newest, the biggest or the nearest, and read the first record.
To use every record, add a Loop. In a round, the list’s name means the current record, and the steps inside the loop work on it. The picker shows it as Current item.
What can a Loop repeat over?
Section titled “What can a Loop repeat over?”| Repeat for | Repeats | Use it to |
|---|---|---|
| Each record in a list | Once per record of a list made above | Email every vendor with an expired contract |
| Each item inside a field | Once per item of a List field on the current record | Go through the lines of an order |
| A number of times | N times, counting from 1 | Do the same thing a fixed number of times, such as creating 3 starter records |
A loop has two paths on the canvas. Each item is the body. After loop is what continues when the rounds end. If a round fails, the workflow stops at that round. A Terminate inside the loop ends the whole workflow, not only the loop.
How do I loop over a large list?
Section titled “How do I loop over a large list?”For a large set of records, switch on Process in pages on the Loop. It reads the list from the database one page at a time. The page size is 200 unless you set another, and Stop after sets when the loop ends.
Where is a list available?
Section titled “Where is a list available?”A list lives while the workflow runs, on the path that made it.
- After an Approval task, load the lists you need again. The workflow resumes with a fresh copy of the record.
- After a loop over records, save what you need with a Record manager inside the loop. A loop that counts keeps its list.
- On the same path. Make the list on the path that uses it, above the steps that read it.
- Running a step again, for example inside a loop, refreshes its list.
To handle an empty list, add a Decision, pick the list itself, and choose the check has no records.
What should I know about Load data?
Section titled “What should I know about Load data?”- It sees every record in the module, whoever started the workflow. Record permissions do not apply.
- You describe the records with rules, such as Status is Pending approval, or with a Smart Script written as a
WHEREclause. See Load data. - Add at least one rule. To load every record, use the Smart Script tab with
WHERE 1 = 1.