Set Variable
Stores a workflow-scoped variable. Use this for counters, accumulators, or "carry this forward" values that need to be referenced by later nodes — without threading them through every edge.
Variables live for the duration of an execution and are isolated per execution. They are deleted when the workflow completes successfully.
Reading variables
Once set, a variable can be referenced anywhere a template expression is allowed:
{{ vars.counter }}
{{ vars.user.email }}The Code node also exposes vars as a read-only object in its expression environment.
Configuration
| Field | Description | Notes |
|---|---|---|
| Operation | What to do with the variable | Set, Increment, Append, Merge, Delete. Defaults to Set. |
| Variable Name | Name of the variable | Required. Templates allowed — e.g., counter_{{data.region}}. |
| Value | The value to store | Required for Set/Append/Merge. JSON-parsed (so 42, true, "hi", [1,2], {"a":1} all work). Bare strings without quotes pass through as plain strings. |
| Increment By | Amount to add | Increment only. Defaults to 1. |
Operations
Set
Replace the variable's value. The previous value is overwritten.
Increment
Atomically add a number to a numeric variable. Safe to use from parallel branches — Redis guarantees atomicity. Starts from 0 if the variable doesn't exist.
Append
Push a value onto an array. Creates the array containing the value if the variable doesn't exist.
Merge
Shallow-merge an object into an object variable. Keys in the new value overwrite existing keys.
Delete
Remove the variable entirely.
Examples
Counter incremented per processed item
Inside a loop / per-item branch, place a Set Variable node with:
- Operation:
Increment - Name:
processed - Increment By:
1
Then reference {{ vars.processed }} in a downstream Email or Slack node.
Aggregate scores from a stream
- Operation:
Append - Name:
scores - Value:
{{data.score}}
After the loop, the Code node can sum them: sum(vars.scores).
Track a running config object
- Operation:
Merge - Name:
config - Value:
{"region": "eu", "tier": "premium"}
Lifetime
| Event | Variables behavior |
|---|---|
| Workflow completes successfully | Variables are deleted. |
| Workflow fails or pauses | Variables persist for 24 hours so the run can be resumed. |
| Each operation | The 24-hour TTL is refreshed. |
WARNING
Variables are per-execution. They are not shared across separate runs of the same workflow. To share state between runs, use the DataStore nodes or an external database.