Select the version of Power Virtual Agents you're using here:
[This topic is pre-release documentation and is subject to change.]
Variables let you save responses from your customers in a conversation with your bot so that you can reuse them later in the conversation.
For example, you can save a customer's name in a variable called
UserName. The bot can then address the customer by name as the conversation continues.
You can use variables to create logical expressions that dynamically route the customer down different conversation paths. You can also feed variables to Power Automate and Bot Framework Skills as input parameters, and save the output results from those actions.
Entity and variable type
Power Virtual Agents uses entities to understand and identify a specific type of information from a user's responses. When saving the identified information to a variable, a variable type will be associated with it. The variable type is analogous with the entity.
Each entity or variable type maps to a base type, as listed in the following table.
The base type defines the operators that can be used for the corresponding variable when constructing a logical expression. It also defines whether a variable can be used to feed to an input parameter in a flow or Bot Framework Skill as an input parameter.
For example, a boolean base type maps to an operator "is equal to" with possible values being true or false, while a number base type will give you a series of numeric operators such as "is equal to", "is greater than", or "is greater than or equal to", and so on.
|Entity||Variable Base Type|
|Multiple choice options||string|
|User's entire response||string|
|Country or region||string|
|Date and time||string|
|Point of interest||string|
Create a variable
In the bot authoring canvas, add a question node by choosing Ask a question. A variable will be automatically created within the node.
Create a variable:
Go to the Topics page for the bot you want to edit.
Open the authoring canvas for the topic you want to add a variable to.
Click the plus (+) icon and select Ask a question.
You'll notice a variable that contains the user's response is automatically created.
Pick an entity to use
By default, the question node will be created using Multiple choice options, but you can also pick a different prebuilt or custom entity by choosing what to identify from the node. For example, you can choose Person name to use that entity.
Rename a variable
When a variable is automatically created, a default name will be given. You rename a variable by selecting the variable name, entering a new name, and selecting Done to save the new name.
Use variables in action nodes
When using a variable in an action node, if a variable's base type matches with a parameter type specified for a flow or Bot Framework Skill, it will show up as a candidate to be used to feed to this parameter. The output from the action nodes will generate new variables as well.