Flow control and conditions
This page covers the steps that decide where a run goes: Filter, If / else, Switch, Wait, Repeat and Approval, and the conditions they use.
For the actions themselves, see the Action reference.
How a run moves through the chart
- The trigger fires and starts a run.
- The run follows each connection from the trigger to the next step.
- A step that branches (If / else, Switch, Repeat, Approval) picks one connection to follow. Every other step follows all of its connections.
- The run ends when no step is left to follow.
A path that reaches a Filter whose conditions fail stops there. Other paths carry on.
Conditions
Filter, If / else, Switch and the "until" form of Repeat all use conditions. A condition compares one value with something you give.
| Part | Notes |
|---|---|
| Value | A value from the trigger, from an earlier step (steps.<step id>.<value>) or from the current repeat (loop.item.<field>, loop.index, loop.count). |
| Comparison | See the table below. Which ones you can pick depends on the value's type. |
| Compare with | A number, text, or a list for "is any of" and "is none of". |
Several conditions are joined with all (every one must pass) or any (one is enough). A group of conditions can hold one more group inside it, no deeper.
Comparisons by type
| Comparison | Text | Number | One of a list | ID |
|---|---|---|---|---|
| is | Yes | Yes | Yes | Yes |
| is not | Yes | Yes | Yes | Yes |
| contains | Yes | |||
| does not contain | Yes | |||
| greater than | Yes | |||
| at least | Yes | |||
| less than | Yes | |||
| at most | Yes | |||
| is any of | Yes | Yes | Yes | Yes |
| is none of | Yes | Yes | Yes | Yes |
| is empty | Yes | Yes | Yes | Yes |
| is not empty | Yes | Yes | Yes | Yes |
When a value is missing
If the run has no value for the name you compare, the condition fails. The two exceptions are is empty, which passes, and is not empty, which fails.
A condition on a value the trigger does not offer is refused when you save, so a misspelt name cannot silently fail forever. A Webhook received trigger accepts any path under body., because its JSON is yours to choose.
Filter
Continues only when its conditions pass. When they fail, that path stops and the run records the step as "stopped". Use it straight after the trigger to say which records the automation is about.
If / else
Takes the True connection when its conditions pass and the False connection when they do not. You can leave either side unconnected.
Let AI decide
Instead of conditions, switch on Let AI decide and write the question as a sentence, for example "Is this customer complaining about delivery?". The AI answers yes or no from the run's data, and the step takes that path. This uses AI credits. See AI steps.
Switch
Holds up to 20 cases. The run takes the first case whose conditions pass, in the order they are listed. If none passes, it takes the Default connection.
Switch can also let AI pick: give every case a clear label and the AI chooses the one that fits.
Wait
Pauses the run, then carries on.
| Form | Setting | Limit |
|---|---|---|
| For a set time | An amount in minutes, hours or days | 30 days |
| Until a date | A date value such as {{duedate}} or {{steps.calc.result}}, or a fixed date and time | A date already in the past continues at once |
While a run waits, its status is "waiting". Cashfin checks every minute for runs that are due, so a wait ends within about a minute of its time.
If the automation is switched off while a run is waiting, that run fails with "the automation was turned off while this run was waiting". If the automation is deleted, the run fails with "the automation was deleted while this run was waiting".
Repeat
Repeats the steps connected to its Each connection, then follows its Done connection once.
| Form | Setting | What it does |
|---|---|---|
| For each | A list | Runs the steps once for every item in the list. |
| A number of times | A number from 1 to 500 | Runs the steps that many times. |
| Until | Conditions, plus the most repeats (1 to 500) | Runs the steps, checks the conditions, and stops when they pass or when the most repeats is reached. |
Values inside the repeated steps:
| Value | What it holds |
|---|---|
{{loop.item}} | The current item (For each). For a list of records, read a field with {{loop.item.<field>}}. |
{{loop.index}} | Which repeat this is, counting from 0. |
{{loop.count}} | How many repeats there will be (For each and A number of times). |
Where a list comes from:
- A Run a Cashfin action step that looks records up, for example
steps.find.data. - A Calculate step whose result is a list.
- A Send HTTP request step that returned a JSON list, for example
steps.fetch.json.items. - A list sent to a Webhook received trigger, for example
body.orders.
Rules:
- A Repeat can hold another Repeat, up to 3 deep.
- A Repeat goes round at most 500 times. A list longer than that fails the run with a message.
- A Wait inside a Repeat is allowed. The run remembers which repeat it was on.
- A very long Repeat is processed in batches. Between batches the run shows as "waiting" for a moment.
- After the last repeat, the step's own values are
iterations(how many times it went round) andfinished.
Approval
Pauses the run until someone decides in the approvals inbox, then takes the Approved or Rejected connection.
| Setting | Notes |
|---|---|
| Title | What approvers see. Accepts values in curly brackets. |
| Message | The detail approvers read before deciding. |
| Time limit | Minutes, hours or days, up to 30 days. 3 days when left empty. |
If nobody decides within the time limit, the run takes the Rejected connection.
If a step fails
By default a failed step ends its path, and the run is recorded as failed.
Each action step has a Keep going if this step fails switch. With it on, the run records the failure and carries on to the next step. Use it for steps that are nice to have, such as a notification, in front of steps that must happen.