For each
A step that goes through a list. The steps inside run once for each charge, on its own document.
What it is for
A lookup brings a total: “you are owed 125,000 across 4 documents”. That is enough to notify yourself, but not to email each client about their invoice.
For each goes through the documents one by one. Every action inside works on the item’s document, as if the event had been about that document.
How to add it
- Click Add a step › For each.
- In the panel, choose the list under Goes through. If the list has days, adjust them.
- Set Up to how many items: from 1 to 50, and 20 if you leave it.
- On the canvas, add the steps inside the For each item frame.
The lists
| List | What it goes through | Order |
|---|---|---|
| Each overdue charge | Invoices and quotes with a balance past their due date. | From the most overdue to the most recent. |
| Each of the client’s overdue charges | What the event’s client has overdue. | From the most overdue to the most recent. |
| Each charge about to be due | What is due over the next days you choose (1 to 30). | From the soonest to the latest. |
The items are taken when the step starts: what it goes through does not change halfway, even if someone pays in the meantime.
Each of the client’s overdue charges uses the event’s client, so it only works with triggers that carry one: quotes, invoices, payments and clients. With a scheduled trigger, the workflow cannot be published with that list.
What each round reads
| Variable | What it is |
|---|---|
{{item_folio}} |
The invoice or quote number. |
{{item_cliente}} |
The client’s name. |
{{item_saldo}} |
What is left to pay, in the document’s currency. |
{{item_moneda}} |
The document’s currency. |
{{item_vence}} |
The due date. |
{{item_dias_vencido}} |
How many days it has been overdue. For what is not due yet it is zero or a negative number. |
{{item_origen}} |
Whether it is an invoice or a quote. |
These variables only exist inside the step. If you use them outside, the workflow is not published and the editor says so: “The variable {{item_folio}} belongs to each item: it only exists inside “For each”.“
Conditions inside can read them too, for example “Days overdue is at least 7”.
Which document each action works on
Inside For each, Email the client, Send the client a WhatsApp, Create a task and Add a note in HubSpot use the item’s document and client, not the event’s. Send the data to a URL sends the type and id of the item’s document.
What cannot go inside
- Waits: every round runs right away, one after another. If you want to space the messages out, schedule the workflow; for example, every Monday.
- Another For each.
- Actions for a single type of document: Expire the quote, Approve the internal request and Void the invoice. A list mixes invoices and quotes.
If something fails halfway
Each round leaves its own record under Runs: “Round 1”, “Round 2” and so on. The For each step says how many items it went through.
If a step is retrying in round 3, it picks up in that round when it resumes. What already went out in rounds 1 and 2 is not repeated, and each client gets their email only once.
A complete example
“Your Monday: collected, overdue and who to call”, one of the ideas Cord includes, ends with a “For each”:
- When this happens: every Monday at 9, after the weekly summary.
- For each: each overdue charge, up to 20.
- Condition, inside: “Days overdue is at least 30” and “Days overdue is at most 36”: only the ones that crossed 30 days that week.
- Action, if the condition is met: create the task “Call
{{item_cliente}}about{{item_folio}}:{{item_saldo}},{{item_dias_vencido}}days overdue”. Each charge asks for its call only once.
Limits
| Limit | Value |
|---|---|
| Items per run | From 1 to 50; 20 if you leave it |
| For each inside another | Not allowed |
| Waits inside | Not allowed |
The step and the ones inside count toward the maximum of 30 steps per workflow. Each action’s hourly limits still apply: if client emails reach their limit, that step is retried later.