Global Variables
Last updated
Last updated
Global Variables enables you to define global attributes that you can use with any rule & actions on the Nected platform. These are like environment variables that can be set for the entire platform.
You can define the following four types of attributes under Global Variables:
Boolean – The true/false or on/off attributes.
Numeric – The numeric value attributes, such as discount percentage.
String – The string value attributes, such as brand name.
Date – The data attributes, such as start date and end date.
JSON: Represents attributes for selecting JSON object data.
List: Represents attributes for selecting data as lists or arrays.
Note: You cannot leave the global attribute value field blank. You must always provide a value for every global attribute.
The following figure shows the Global Variable page of the Nected platform:
To create a global attribute, follow the below steps:
Click Global Variable in the left navigation to open the Global Variable page.
Click + Add Value and select an attribute type from the dropdown, such as Numeric.
After selecting the attribute type, you'll see two fields, one for the Key and one for the Value. You must provide the attribute name in the Key field and enter the attribute value in the corresponding field.
For adding JSON and LIST attributes, you need to add the information inside the JSON and LIST editor, which we've discussed in the below section.
Click Save to save the attribute.
After you save the attribute, you can use it in any of the rules.
To add JSON or LIST attributes, simply click on the "+Add Value" and from the dropdown list select JSON/LIST as per your requirement. Then,
For the JSON attribute, you'll get a JSON editor. Just click on the JSON Editor, and the editor will be open like this:
Then you can add custom data inside the JSON editor via Raw mode i.e. using low code or via Pretty mode i.e. via no code mode.
After adding your custom JSON data inside the editor, you need to test it and simply close it.
The same thing goes for the LIST attribute.
After selecting the LIST attributes, you need to open the list editor.
Then open the list editor and add the values according to your need. And then test it and simply close it. The list data will be automatically saved.
Now, once you've figured out how to create the global attribute, it's pretty easy to use them inside your rule and workflow. But before understanding how you can use the global attribute, you first need to know where you can use global attributes. So, you can use it in:
Rule Conditions: To add the global attribute in the rule condition, simply add a new condition, and after adding an operator, click on the "Enter Value" field and a dropdown list will appear. Scroll down to the "Global attributes" section and select the matching datatype.
Rule Result: Similarly, click on "+Add Result" and add a new result. And in the input field just select the Global attribute from the dropdown.
In Workflow editor: In the workflow editor, you can use the global attributes as the input values in the rule node, workflow node, Switch Block Node, as well as in the SetVariable Node, like shown below:
Update the value of a global attribute to modify the attribute value throughout the rules and workflows that are using this attribute.
The following procedure shows you how to update an existing global attribute on the Nected platform:
Click Global Variables in the left navigation to open the page.
Edit the attribute value and click Update against the attribute name.
The following procedure shows you how to delete an existing global attribute from the Nected platform:
Open the Global Variable page by clicking the same button from the left navigation bar.
Click the delete icon against the attribute name. Then a Delete Attribute dialogue box will open.
Click Delete to confirm the delete operation.
After you delete the attribute, you must remove it from any rule or workflow that uses this global attribute, else you'll get error.