Teneo Developers

Global Variables

Introduction

Global Variables, as opposed to Flow Variables, are accessible by all Flows in a solution and have an unlimited validity, meaning that Global Variables can hold data that is persistent during the session and only expires when the session ends or times out. Variables get their values from Listeners, and hence the Variables and Listeners are closely connected: a Variable with an empty value must be declared so that a Listener can access it in its operation, and therefore when a Listener's TLML Syntax is fulfilled (usually when a certain user input is found), the script of the Listener is able to assign a certain value to the Variable.

View of Global Variables

The Global Variables are available in the backstage of Teneo Studio by clicking the Solution tab in the main window of Teneo Studio, then Globals and lastly Variables.

Global Variable view

In this view, the user will find:

  • Left side:
    • Text filter
    • List of existing Global Variables
  • Right side:
    • Ribbon options allowing to Edit, Search, Delete, view History, set/unset Stable version, include/exclude in branching (Localization setup); read more in the Edit section below
    • Details of the selected Variable providing a read-only summary
    • Global Variable's Id

Basics

Create

In the Global Variables section in the backstage of Teneo Studio (Solution tab > Globals > Variables), simply follow the below steps to create a new Global Variable:

  • Click Add next to the text filter
  • In the right side of the screen, write a Name and optionally a Description
  • Next, provide the Value of the variable
  • Click Save in the top to preserve the changes.

Edit

In the list of Global Variables:

  • Select the Variable to edit
  • Click Edit (right side of the screen above the Variable's summary)
  • Now, update the Name, Description and/or Value as needed
  • Remember to Save the changes when done, or alternatively click Cancel to discard the changes and exit the edit-mode.

Below please find an overview of more editing options available in the ribbon when working with Global Variables.

ButtonCommentMore information
EditAllows to open the Global Variable in edit-mode
Search - Search by Variable NameAllows to search through all places a variable can be used when referenced by name, for example, in scripts, Output Answers, etc.
Search - Search by Variable ReferenceAllows to search through trigger/transition Match requirements and After Match actions, Flow Link and Integration transfer Variables
DeleteProvides the option to delete a Global VariableDelete Global Variable
HistoryOpens the History of the selected Global Variable; previous versions and revisions of the Global Variable are listed, comments added at save are also displayed here. Select any of the revisions to view its content.Set a previous version as stable by selecting it in the list and clicking Set Stable, restore a previous version by selecting it and clicking Restore.Version flag
Set/unset stableSet the current version of the selected Global Variable as stable or unset itVersion flag
Include/ExcludeInclude or Exclude the selected Global Variable from branching when working in a Localization setupLocalization setup

Save

When a Global Variable is in edit-mode, the Save button becomes available in the ribbon above the details of the Variable itself; click Save to save with comment or alternatively press Alt and click Save to bypass the comment.

Close

In Teneo Studio Desktop, the view of a Global Variable in edit mode is closed by either clicking Cancel or Save to preserve any possible modifications.

Delete

To delete a Global Variable, follow the below steps:

  • Select the variable(s) to be deleted, multi-select is available by pressing Ctrl while selecting.

  • Click Delete in the top-area of the screen.

  • Note that the right-side of the screen will now display an Variable delete pending view, which the user should either Cancel or Apply for each of the selected variables for the actual deletion to be performed.

If Teneo Studio detects that the Global Variable is in use, the user is prompt to confirm a Force delete or Cancel the deletion.

Filter

A text filter is available at the top of the list of Global Listeners; to filter on the available variable, simply writhe the wanted letter combination to start filtering on the list.

Details

Naming conventions

Variables are placeholders for changeable values and can be used to store text strings, Booleans, Lists, Maps (key/value pairs) and numbers. There exist various naming conventions related to computer programming and variable names, for example, snake_case or camelCase, and common to most of these is a need for a project team to use a similar convention which makes the names easy to read and understand for everyone.

Within the Teneo Platform, the scripting language is Groovy and, although not explicitly mentioned in documentation, Groovy makes use of camel case in examples of variable names throughout their documentation (see an example); furthermore, Java describes the use of camel case in their Java Language Basics (see last bullet point).

For Teneo solutions, the following recommendation are available:

  • variable names must be unique within the solution
  • use lower camelCase
  • use a short, yet meaningful name which easily shows the purpose of its use to the reader.

Examples: user, userName, userFirstName, companyName, month, hour