Global Variables (Scope)

From PresenceWiki
(Redirected from Global Variables)
Jump to: navigation, search

Global Variables are variables that are stored in the Presence database (or in the case of a deployed web application in memory and set from the application XML documents), and can therefore be read or written to from different Tasks.

This type of variable can be created in one of two ways - either through a Set Variable Node (with the scope set to "Global") or through the Global Variables Manager. When a Global Variable is dynamically set within a Task its new value will not be visible to other Tasks until the Task has successfully completed. This is to prevent race conditions.

To access the Global Variables Manager:

Top Menu > Task > Manage Global Variables

The Manage Global Variables Dialog

This is what the Global Variables Manager dialog looks like:

Global variables dialog.png

The existing Global Variables are listed on the left hand side organised in a tree structure. When creating Global Variables we recommend the use of periods (.) to separate categories of variable, for example:

${department.task.variablename}

The tree structure looks for periods in the variable name to create the enclosing folders, so the above variable could be found by expanding the "department" and "task" folders.

If you have a large number of Global Variables it can be useful to restrict those that are displayed based on a search filter - click the "Filter.." button above the list to achieve this.

Clicking on a Global Variable displays the value of the variable in the right-hand pane, unless the value has been secured with a password, in which case you will be presented with an alert box prompting you to enter the password.

If you wish to edit the value of the variable, do so in the text field to the right and then make sure to click the "Update" button above.

Creating a new Global Variable from the Global Variables Manager

To create a new Global Variable, right click on the variables tree to bring up the pop-up menu and select "New Variable".


New global variable.png

Enter a Variable name in the field provided with the use of periods if desired for organisation. If you wish to password protect the value select "Lock with password" and enter the password in the appropriate field. You can always password-protect a variable at a later date by right-clicking on the variable name from the tree and selecting "Password Protect" from the pop-up menu.

Remember that when editing the new value you must click the "Update" button to store the changes.

Password Protection

Once a variable has been password protected any attempts to read or reference it normally within a Task will result in an exception (VariableLockedException). In order to access it you must first place a Variable Unlocker node before the node that attempts to read the variable.


Task Elements > Variable Nodes > Global Variables (Scope)

See Also: Require Variable(s) | Set Variable | Multiple Variable Setter | Variable Unlocker