Teneo Developers

Global Scripted Context

Provide dialogue context

The Global Scripted Contexts enable Teneo users to define context scripts to ensure that the end-user of the application is presented with the correct answer based on the context of a dialogue.

Global Scripted Contexts can be written and maintained by script-savvy users while other users easily apply them throughout the solution without needing to know how they work or how to script.

A Global Context consists of a script and a set of expected states and are assigned to either Triggers or Transitions; once defined, these scripts are executed at runtime, calculating the current state of the defined Context and testing it against the expected states. If successful, the Trigger or Transition will be set off. By using Context, the Triggers and Transitions depend both on the established Match Requirements and the scripted states.

The Global Context are defined and maintained in one place and can be used in Flows whenever needed.


The main part of a Global Context is a script which defines how the context state should be determined. When executed at runtime, it will return a value representing the current state of the dialogue at the point when the assigned context is tested.

The value returned by the Scripted Context definition can be any Groovy type or any custom type which can be usefully compared with Groovy's equals operator ==.


Multiple Context States

Assigning multiple Context states to a Trigger/Transition will apply the Contexts with an OR. For example, LatestTopic is Weather OR Directions or Maps.

Multiple Contexts

Assigning multiple Contexts to a Trigger/Transition will apply the contexts with an AND. For example, LatestTopic is Weather AND UserLocationIsKnown.

Working with Global Context
Scripts and Groovy in Teneo Studio