Set Variable Node

The Set Variable Node defines or updates a workflow variable for use later in your flow.


Store static or dynamic values to be accessed by other nodes downstream.

Purpose

  • Storing Intermediate Results: Save output for later use.
  • Parameter Configuration: Set dynamic parameters for other nodes.
  • State Management: Maintain a counter, flag, or status.
  • Data Extraction: Pull a specific value from complex input data for reuse.

Configuration

Configurable properties:

PropertyTypeDescriptionDefault
labelstring (optional)Descriptive name for the node instance.'Set Variable'
variableNamestring (optional)Name of the variable to create or update.'myVar'
variableValueany (optional)The value to set for the variable (static or dynamic, e.g., from input data).''
Variable Value Syntax & Evaluation

Value types: variableValue can be string, number, boolean, object, or array.
Static: Directly sets value (e.g., Hello World).
Dynamic: Reference data from input using templating (e.g., {{input.user.id}}).
Empty: If left blank, check if the variable becomes null, undefined, or triggers an error.
Refer to backend docs for syntax and resolution details.

Variable Scope & Access

Scope: Where is the variable accessible? (Global to the workflow? Local to a branch?)
Access in other nodes: How to reference? (e.g., {vars.myVar}, flow.variables.myVar)
Check backend/workflow documentation for exact usage.

Inputs and Outputs

Input (Left Handle):
Receives data from upstream, which can be referenced in variableValue if dynamic.

Output (Right Handle, id: "output"):
Emits the exact same data it received; the node's purpose is to set a variable as a side effect.

Logic of Execution

  1. Receives input data.
  2. Evaluates variableValue (static or from input).
  3. Sets or updates variableName to that value, according to scope rules.
  4. Emits the original input data unchanged.

Example: Storing a User ID from API Response

Input Data Example:

{
"userProfile": {
  "id": "user-789_abc",
  "name": "Jane Doe",
  "email": "jane.doe@example.com"
},
"status": "success"
}

Node Configuration:

  • label: Store User ID
  • variableName: activeUserID
  • variableValue: {{input.userProfile.id}}

Execution:

Notes and Considerations

  • Variable Naming: Use clear names, follow a naming convention.
  • Overwriting: Last set wins (within scope).
  • Data Types: Ensure downstream compatibility.
  • Debugging: Inspect variable values at various stages if the platform supports it.

The Set Variable Node enables state, parameterization, and dynamic logic for any workflow.

Loading search features...