Variables
The variables an expression can read, with their type and an example each — the current input, the output of any earlier node, the run, the workflow, the node itself, dates and ids — and the names that do not exist.
Every expression can read the variables below. They describe one node execution: the data that reached the node, the nodes that already ran, the run and the workflow it belongs to.
| Variable | Type | What it holds |
|---|---|---|
$json | object | The input of the current node. |
$input | object | The same input, as an item. |
$('Node label') | function | The output of an earlier node, looked up by its label. |
$execution | object | Ids of the current run. |
$workflow | object | Slug and version of the workflow. |
$node | object | Id and label of the current node. |
$now, $today | Luxon DateTime | The current moment and the start of today. |
$uuid | string | A new UUID v4 on every read. |
$json
$json is the input of the current node: the output of the node that routed to it. For the first node after the
trigger, it is the trigger’s input.
{{ $json.customer.email }}
{{ $json.items.length }}A webhook trigger delivers the raw request as { body, headers, query, method }, so the node right after it reads the
request fields under body:
{{ $json.body.order_id }}
{{ $json.headers['content-type'] }}$json changes from node to node. To read the webhook body further down the graph, use $('Webhook Receiver')
(below), not $json.
$input
$input wraps the same input as an item, for expressions written in the item style:
| Member | Returns |
|---|---|
$input.item | { json }, where json is $json |
$input.first(), $input.last() | The same item |
$input.all() | A list with exactly one item |
{{ $input.item.json.status }}A node handles one item per execution, so $input.all() always returns one element.
$(‘Node label’)
$ is a function: it takes the label of a node that already ran in this execution (the name shown on the canvas)
and returns an accessor. When a node has no label, use its node_id.
| Member | Returns |
|---|---|
.item | { json } with the output of that node |
.first(), .last() | The same item |
.all() | A list with that item |
.isExecuted | true when the node already ran in this execution |
{{ $('Normalize input').item.json.correlation_id }}
{{ $('Webhook Receiver').item.json.body.email }}
{{ $('Enrich customer').isExecuted }}For a node that did not run (it is on another branch, or after the current one), .item returns { json: {} }, so
reading a field gives undefined instead of an error. Check .isExecuted when the difference matters.
$execution
Ids of the current run. Write them in messages, tasks and logs so anyone can trace a case back to its run.
| Field | Contains |
|---|---|
id | The principal id of the run. When the run was started by workflow.chain, it is the id of the root run, so the whole chain shares it. |
flow_instance_result_id | The principal result id (same as id). |
root_flow_instance_result_id | The result id of the root run of a chain. |
run_flow_instance_result_id | The result id of this specific run, also inside a chain. |
flow_instance_id | The id of the flow instance. |
flow_definition_id | The id of the workflow definition. |
flow_version_id | The id of the published version that runs. |
flow_slug | The workflow slug. |
Case received. Reference: {{ $execution.id }}Fields that are not available in a run are null.
$workflow
| Field | Contains |
|---|---|
slug | The workflow slug. |
version | Identifies the version that runs. Treat it as an opaque value, not as a number. |
{{ $workflow.slug + '@' + $workflow.version }}Use only these two fields. For the id of the definition, use $execution.flow_definition_id.
$node
Metadata of the node being executed: id (its node_id), label and name (equal to label).
Created by {{ $node.label }} in {{ $workflow.slug }}$now and $today
$now is a Luxon DateTime for the moment the node runs. $today is the start of the
current day. Both use the server’s time zone, so set the zone you need before formatting:
{{ $now.setZone('America/Bogota').toFormat('yyyy-LL-dd HH:mm') }}
{{ $now.setZone('UTC').toISO() }}
{{ $today.plus({ days: 30 }).toISODate() }}In a mixed field, format the date yourself (toISO(), toFormat(…)): a bare $now is inserted as a quoted JSON
string.
$uuid
A new random UUID v4 each time you read it. It is a property, not a function:
{{ $uuid }}Two reads give two different values. When several nodes need the same id, generate it once (for example in a
data.transform) and read it from that node with $('…').
What does not exist
| Not available | Use instead |
|---|---|
$node["X"].json | $node is only the current node’s metadata. Use $('X').item.json. |
$items() | $input.all() or $('X').all(). |
$parameter | The node’s own configuration is not exposed. |
$config | Service configuration is not exposed. |
| Several items per node | Each execution of a node handles one item. Iterate with flow.split and flow.join. |
A name that does not exist throws … is not defined: a mixed field shows [ERROR: …] and a pure field keeps its {{ … }} text unresolved.