Skip to main content

Set Variable

Controlled node

Overview

The Set Variable node stores data in a named variable that can be accessed elsewhere in your workflow. Variables persist across the workflow execution and can be used to pass data between different branches or iterations of your automation.

By default, variables are stored in the local scope (parent workflow), meaning they are accessible to nodes in the same workflow context. However, you can enable the Global option to store variables at the root workflow level, making them accessible across nested workflows and sub-flows.

The node supports Handlebars templating in the variable name field, allowing you to dynamically construct variable names or paths based on runtime data. When you use template syntax like {{userId}} in the name field, the node automatically creates corresponding inputs for those variables.

Variable Scoping

  • Local Scope (default): Variables are stored in the parent workflow's variable map. These are accessible to nodes within the same workflow but not to parent or sibling workflows.
  • Global Scope: When isGlobal is enabled, variables are stored in the root workflow's variable map, making them accessible across all nested workflows and sub-flows.

Path Support

Variable names support dot notation for nested paths (e.g., user.profile.name). The node uses advancedSet logic to create nested object structures automatically if they don't exist.

Inputs

InputTypeDescriptionDefault
SetEventTriggers the node to store the value in the specified variable name.-
NameTextThe variable name or path where the value should be stored. Supports Handlebars templating (e.g., user.{{type}}.name) and dot notation for nested paths.-
ValueTextThe data to store in the variable. Can be any type (string, number, object, array).-
DynamicDataAdditional inputs are automatically created when Handlebars variables are detected in the Name field (e.g., if you use {{id}} in the name, an id input appears).-

Properties

PropertyTypeDescriptionDefault
Is GlobalBooleanIf enabled, stores the variable in the global (root workflow) scope instead of the local parent scope.false

Outputs

OutputTypeDescription
DoneEventFires when the variable has been successfully set.

Runtime Behavior

When the Set event is triggered, the node:

  1. Evaluates the Name field, processing any Handlebars templates using available input data and existing variables
  2. Resolves the target path (supporting nested object creation via dot notation)
  3. Stores the Value in either the parent workflow's variables (local) or root workflow's variables (global) based on the Is Global setting
  4. Triggers the Done event

If the Name field contains Handlebars expressions like {{userId}}, the node dynamically creates input sockets for those variables. These inputs must be connected or provided for the template to resolve correctly.

Example

Basic Variable Storage

Store a simple value in a local variable:

  1. Connect a trigger event to the Set input
  2. Set Name to customerName
  3. Set Value to "John Doe" (or connect a data source)
  4. The variable customerName is now accessible via a Variable node elsewhere in your workflow

Nested Object Creation

Create nested structures automatically:

  1. Set Name to order.details.shippingAddress
  2. Set Value to an object or text
  3. The node creates the nested object structure if it doesn't exist, or updates the specific path if it does

Dynamic Variable Names with Templates

Use runtime data to determine the variable name:

  1. Set Name to user.{{userId}}.status
  2. The node automatically creates a userId input socket
  3. Connect a data source to the userId input (e.g., a text node with value "12345")
  4. Connect the Value input to the data you want to store
  5. When triggered, the variable is stored at user.12345.status (or whatever value userId resolves to)

Global Variable Sharing

Share data across nested workflows:

  1. Enable Is Global in the properties panel
  2. Set Name to sharedConfig
  3. Set Value to your configuration object
  4. Access this variable from any nested workflow using a Variable node with the same name, regardless of workflow depth