Get Variable
The Get Variable node is a utility component designed to retrieve variables that were previously saved using the Set Variable node. It allows for dynamic access to stored data within a workflow.
Node Details
-
Name: GetVariable
-
Type: GetVariable_Utilities
-
Version: 2.0
-
Category: Utilities
Description
This node is used to access variables that have been stored earlier in the workflow using the Set Variable node. It provides a way to retrieve and use previously saved data, enabling dynamic and flexible workflows.
Input Parameters
Label | Name | Type | Description |
---|---|---|---|
Variable Name | variableName | string | The name of the variable to retrieve. |
Outputs
Label | Name | Base Classes |
---|---|---|
Output | output | string, number, boolean, json, array |
The output can be of various types, depending on what was stored in the variable.
Usage
-
Configure the node by specifying the name of the variable you want to retrieve in the “Variable Name” input.
-
The node will attempt to fetch the value associated with that variable name from the
dynamicVariables
object. -
If the variable exists, its value is returned as the output.
-
If the variable doesn’t exist, the output will be
undefined
.
Implementation Details
-
The node checks for the existence of the specified variable name in the
dynamicVariables
object, which is passed through theoptions
parameter. -
It uses
Object.prototype.hasOwnProperty.call()
to safely check if the variable exists, avoiding potential issues with inherited properties. -
The retrieved value can be of any type that was originally stored (string, number, boolean, JSON object, or array).
Use Cases
-
Retrieving user inputs stored earlier in the workflow
-
Accessing calculated values or API responses saved in previous steps
-
Implementing conditional logic based on stored variables
-
Passing data between different branches or stages of a complex workflow
Notes
-
Ensure that the variable you’re trying to retrieve has been set using a Set Variable node earlier in the workflow.
-
The variable name is case-sensitive, so make sure to use the exact name used when setting the variable.
-
This node is particularly useful in conjunction with other utility nodes and flow control nodes to create dynamic and responsive workflows.