Script
Routes the flow on what a script works out. Reach for it only when the rule can't be expressed with an Expression condition, such as a check that combines several fields. Routes to true when the script's result counts as true, otherwise to false.
Fields
| Field | Description |
|---|---|
| Script | Where the script comes from: Inline, Saved or Runtime, the same three sources as the Script action; see Where the script comes from. |
| Language | For an Inline script, the language it is written in. Choosing JavaScript reveals the Script field holding the source. |
| Script (source code) | For an Inline script, the source, checked for syntax errors as you type. |
An empty script doesn't block saving; the step shows a needs-attention note instead, and fails at run time. See Building automations.
You don't have to write the script yourself. As on the Script action, Esca can write an Inline script for you from a sentence describing the rule.
What the script can read
The same values as the Script action: payload, the output of the step before this one; input, the values mapped into the step on its Input tab; and dari, for the workspace's content types. See Where a script runs.
The script's result is the value of its last expression. This one routes an article to true when it has more than three tags and no lead image:
1const article = payload;2article.tags.length > 3 && !article.leadImage
A result of null, false, zero, empty text or an empty list routes to false; anything else routes to true, the same rule as Is Truthy on the Expression condition; see Comparisons. A script that can't run, for want of code or because it throws, fails the step rather than routing; see When a script fails.
What later steps see
The incoming data, passed through unchanged on whichever path was chosen. A Script condition decides a route; it contributes no value of its own.
Limits
The same sandbox and the same ceilings as everywhere a script runs; see Limits.