Dynamic Variables provide a powerful way to manage and change data that is used in a Flow during runtime, including data that is brought into Interact from external sources like databases and Natural Language Processing (NLP) engines.
A Dynamic Variable always consists of a JSON object, enabling its content to be changed anytime to suit the current data needs of a Flow.
Dynamic Variables are created and maintained like any System Variable in Interact, and you can use them in most Designer elements like any other variable.
Creating a Dynamic Variable
While Dynamic Variables are very flexible, there are several limitations on their use in Interact.
- They cannot be assigned to a Custom Type field.
- They cannot be assigned to a Collection.
Accessing a Dynamic Variable with JSON
Because a Dynamic Variable is not a strictly defined type in Interact, you can add content to it directly using standard JSON code. You can see an example of doing this with the Allocator below.
To access specific values from a Dynamic Variable, you use an object-style format:
For example: RentalPackage.checkin
Using a Dynamic Variable in the Allocator
Dynamic Variables are especially useful when allocating values to variable using the Allocator.
Because you can assign and change its content using a standard JSON object, a Dynamic Variable enables great flexibility in how your Flow can proceed. You can add or remove JSON elements to the Dynamic Variable at any time, as well as change the entire structure of the Variable, if needed. You can also use JSON objects that are supplied from external sources like databases and NLP engines.
In the following example, (A) shows how we can assign information to a Dynamic Variable named RentalPackage by entering or pasting valid JSON code. The complete object looks like this:
"extras1":"king size bed",
This code may also be supplied by entering another Dynamic Variable instead of the code itself. In (B) we enter a static date to assign the value of the Dynamic Variable element named RentalPackage.checkin. In (C) we use regular variables for an allocation.
We can design a paragraph element with Dynamic Variables that use the values we have allocated:
During runtime, we can see how the resulting Dynamic Variables are parsed from the JSON:
We've also added the full JSON object at the end of the example to show the complete content of the Dynamic Variable following the assignment in the Allocator.
Using a Dynamic Variable in Other Designer Elements
A Dynamic Variable is used like any other System Variable:
- You can create User Variables based on a Dynamic Variable.
- You can use a Dynamic Variable in:
- Global Rules
- Decision Points
- Integration Point Mappings (Designer)
- Show/Hide Rules
- Navigation Buttons
- Page Names
- Response Elements
When added to a Designer element, a Dynamic Variable uses an object-style format:
Here's an example of how a Dynamic Variable can appear in a Decision Point:
Just like any other variable, Interact will notify you of data conflicts that arise when using the Dynamic Variable in a Flow. Similarly, Interact will not allow you to rename or delete any Dynamic Variable that is currently used by an Approved Flow.