Skip to content

Using global variables

Overview

Iconnek SYNC provides a global context that allows data to be shared across nodes within a flow.

Nodes can access and manipulate global variables using the scenario object. This object provides a namespace for storing and retrieving data that persists while a scenario is running.

Storing data context

Aside from the msg object, the function can also store data in the global variables.

More information about Global Variables within Iconnek is available here.

To set a value in a global variable:

javascript
vars.myGlobalVariable = "this is a value";

To get a value from global variables:

javascript
const myVariable = vars.myGlobalVariable

INFO

Scope: It's important to note that global variables are shared across all nodes within a scenario. Care should be taken to avoid naming conflicts and unintended side effects.