Set Variable
Set Variable saves a value under a name so that other nodes can read it later.
Screenshot placeholder
When to use it
Use it when a value is needed several steps later, or in more than one place, and you do not want to wire it through every node in between.
Settings
| Field | What it does | Notes |
|---|---|---|
| Variable name | Name of the workflow variable to set | Placeholder my_variable |
| Value expression | The value to save | A Jinja2 expression. Placeholder {{ _prev_output.field_name }} |
| Scope | How far the variable reaches | Workflow (persists across nodes) (default) or Node (local to this execution) |
Inputs and outputs
- One input at the top and one output at the bottom.
- Read the value with Get Variable, using the same name.
Example
Illustrative. Set Variable name to customer_id and Value expression to {{ _prev_output.id }}. A later Get Variable node reads customer_id.
Tips
- Use clear names. The variable name is how you find the value again.
- Keep Scope on Workflow if another node needs the value.