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

LabelNameTypeDescription
Variable NamevariableNamestringThe name of the variable to retrieve.

Outputs

LabelNameBase Classes
Outputoutputstring, number, boolean, json, array

The output can be of various types, depending on what was stored in the variable.

Usage

  1. Configure the node by specifying the name of the variable you want to retrieve in the “Variable Name” input.

  2. The node will attempt to fetch the value associated with that variable name from the dynamicVariables object.

  3. If the variable exists, its value is returned as the output.

  4. 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 the options 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.