Skip to main content

Flow Variables

Flow Variables allow you to store and remember values during the processing of a Flow.

The sections on this page provide information about the various aspects of Flow Variables:

Concept

Flow Variables allow you to store and remember values during the processing of a Flow. A Flow Variable's value is assigned by a Listener, which listens to user input and picks up information depending on the TLML Syntax that the user has given it. In order to use a Listener and populate the value of a Flow Variable, it is first necessary to declare a Flow Variable with an empty value.

In Teneo, a Flow Variable may be of any type that Groovy (and Java) supports, such as: strings, Booleans, Maps (key/value pairs), Lists and numbers. It is also possible to populate and edit a variable with a script and you can even store the results of an Integration or a Sub-Flow in a variable. Flow Variables are only accessible in the Flow in which they are declared and anything you store in a Flow Variable will be forgotten once the Flow has finished processing and dropped from the flow stack. To use variables across Flows, you have to use Global Variables instead.

Naming conventions

Various variable naming conventions, such as snake_case or camelCase, exist for easier understanding within a team. Since the scripting language within the Teneo Platform is Groovy, variables make use of camelCase.

The naming conventions are the following:

  • 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 of valid variable names: user, userName, userFirstName, companyName, month, hour

info

To better understand camelCase, see Java Language Basics (last bullet point).

How To

Add

To add a Flow Variable in Teneo Studio Web, simply follow the below steps:

  1. In the Flow editor, click the Variable button available in the upper, left side of the Flow window.

Variable button

  1. Click the Plus icon to add a new variable.
  2. Now, give the variable a name and write the initial value. The initial value should still be defined even if it is empty, by using an empty string " ".
  3. Optionally, click Add description to write a description of the variable.
  4. Click Confirm.
  5. Remember to Save the Flow to preserve the changes.

Edit

To edit a Flow Variable, follow the below steps:

  1. Click the Variable button.
  2. Next to the name of the existing variable, click the pencil icon.
  3. Now, modify the wanted specifications.
  4. Click Confirm.
  5. Remember to Save the Flow to preserve the changes.

Delete

To delete a Flow Variable, follow the below steps:

  1. Click the Variable button.
  2. Next to the name of an existing variable, click the Recycle bin.
  3. Remember to Save the Flow to preserve the changes.

UI

SectionDescription
Variables iconOpens Flow Variables.
NameName of the Variable.
Add descriptionOptional field to add a description of the Variable.
Initial ValueSet initial value of the Variable. Use empty string " " if value is not defined in the beginning.
Confirm / CancelConfirm or cancel changes.

Practical Examples

Create a Flow Variable

To create a Flow Variable, open a Flow in 'Edit' mode and select the Variable icon under the minimap. Click on 'Add' and provide a name and a default value. In the example below, we have the variable orderedCoffeeType, which has an empty string "" as the default value.

variables-1