Using global variables

Storing and reusing values across multiple workflows.

As an example of working with global variables, let's create a scenario, the result of which would be to create a global variable and get a list of all global variables, including the created one.

Three nodes must be added for the scenario to work successfully:

Notion image
  • (1) Trigger on Run once node to run the scenario after clicking on the Run once button;
  • (2) SetGlobalVariables node to create a global variable TestGlVar2;
Notion image
  • (3) Node JavaScript with code, to get a list of all existing global variables.
export default async function run({ execution_id, input, data, store }) {
 // List Global vars directly from JS

const List = await store.listGlobalVariables()

 return {
List
 }
}
๐Ÿ’ก
You can see other examples of using the JavaScript node to work with global variables here.

The result of the scenario execution is the retrieval of all global variables, including the created one.

Notion image
Notion image
Did this answer your question?
๐Ÿ˜ž
๐Ÿ˜
๐Ÿคฉ