Global, Flow and Environment Variables
Each flow contains one or multiple chains of nodes that branch, are combined with subflows, or linked to different flows. Managing variables and scopes of access to these variables can have different approaches.
Using function node to access global and flow variables
You can add context data with global and flow variables. Those can be created programmatically in the function node. Those variables can be set and fetched with two commands. In most cases, using the global variables is fitting most use cases.
Global Context | Flow Context | |
---|---|---|
Description | Variables are accessible by every node across any flow tab within the same flow app. | Variables are only accessible by nodes on the same flow tab. |
Set a variable with JavaScript | Use the
JS
| Use the
JS
|
Retrieve a variable with JavaScript | Use the
JS
| Use the
JS
|
When you use qibb’s Secret Manager, it automatically creates the nested global variables SECRETS
and SECRETS_METADATA
in your flow, making it easy to reference your secrets. Those variables are designed to be readonly and can only be updated from the Space Secrets Tab in the Portal.
For more information, see Managing secrets in your space and accessing them from your flows.
Using JSONATA to access global and flow variables
Certain nodes allow you to apply JSONATA, such as the qibb API nodes, inject or change nodes. You can read global and flow variables using JSONATA expressions:

Use JSONATA expressions in qibb API nodes to easily access and map global variables directly within the JSON Body.
Global Context | Flow Context | |
---|---|---|
Description | Variables are accessible by every node across any flow tab within the same flow app. | Variables are only accessible by nodes on the same flow tab. |
Retrieve a variable with JSONATA | Use the
JS
| Use the
JS
|
View global and flow variables in Sidebar
You can check existing flow or global variables directly from the right sidebar of the Flow Editor. Navigate to “Context Data” tab and click on the “🔄Refresh” button to see the variables.

View variables in “Context” tab within right sidebar
Working with environment variables
Environment variables can be added to subflows, see Working with subflows . New variables can be added to their Node options. The environment variables are then accessible in every node in the subflow. They can be used as variables in a function node or as JSONata expressions.
//JavaScript
msg.payload = env.get('EnvVar')
//JSONata
$env('EnvVar')
Some nodes, like the Change node, provide the option to set or change the value of environment variables with the env variable option as part of a selection of data types.
Environment variables help to control the information that is available in a subflow. When working with multiple flows and subflows, controlling variables that are accessible at any given point in your project can get complicated. Using environment variables in subflows helps set scopes for values and structure the flow of data through a flow of nodes.
Configuration nodes
The context data can be used to create configuration nodes. Configuration nodes can store information that should be available to every node in the flow or project. The advantage of a configuration node is having a dedicated space for input values. Instead of updating hardcoded information in every node in your project, you can set them up to use context variables and edit only the configuration node if the values have to be updated.
Node-RED creates its configuration nodes. Those are automatically created. Users can't create a configuration node outside of the workspace.
You can create the functionality of a configuration node in different ways. You can use every node that alters or creates context data. Both Change and Function nodes let you access context data. You can add them at the start of your flow to set the values every time the flow gets triggered. Alternatively, you can place these nodes into their separate flow or disconnected them from the other nodes. You only have to trigger them to store the values. A simple trigger would be manual with an Inject node.
The Config node, which is preinstalled but not part of the core nodes of Node-RED, provides the exact functionality of a configuration node. You can set global and flow values. The node doesn't have to be triggered. The variables are created and stored immediately after a redeployment. You can set up multiple nodes and switch between them by setting the node you want to use to activate and deactivate the other configuration nodes.