Manage context variables
Applies to: Dynamics 365 Contact Center—embedded, Dynamics 365 Contact Center—standalone, and Dynamics 365 Customer Service
Important
Power Virtual Agents capabilities and features are now part of Microsoft Copilot Studio following significant investments in generative AI and enhanced integrations across Microsoft Copilot.
Some articles and screenshots might refer to Power Virtual Agents while we update documentation and training content.
Context variables enrich conversations with pre-conversation data, channel data, and custom context data. These attributes can then be used to define routing rules to route conversations to different queues. Context variables are also used in customer service representative (service representative or representative) productivity tools like macros and agent scripts.
This article lists the considerations to use context variables and how you can create them.
Considerations
When you configure context variables, check for the following conditions:
- The context variable name must be less than or equal to 100 characters.
- The context variable value must be less than or equal to 4,000 characters.
- Use exact match to pass the value to the context variable because it is case-sensitive.
- Use the context variable names as defined and don't change them when you author flows in Azure or Power Virtual Agents bots.
We recommend that you don't update or delete the context variables after you create them. If you do need to update or delete the variables, make sure that they aren't used in any of the unified routing classification or assignment rules.
Add context variables
- In the site map of Customer Service admin center or Contact Center admin center, select Workstreams in Customer support and open a workstream from the list.
- Select Add context variable in the Advanced settings section of a workstream.
- In the Edit pane, select Add, and enter Name. Make sure that the variable name is less than or equal to 100 characters.
- Select the Type of variable from the dropdown list. You can choose either Text or Number.
- Repeat steps 3 and 4 to create the required variables.
Configure context variables for AI agents
You can also configure context variables for AI agents created in Azure and Copilot Studio in the application. When customers initiate a conversation, the relevant context that's related to the customer, the issue they're facing, and recent activities performed by them can be made available for the AI agent (agent) to intelligently provide contextual responses to resolve customer issues in a quick and efficient manner. For example, the agent can use the signed-in user details to look up the recent case information or order history of the customer and provide a response. Similarly, customers can configure context variables for the agent to pass on pre-conversation information, custom context, or recent pages that they browsed on a website. Context variables set by the agent can also be passed to Dynamics 365 when it escalates to the service representative. For example, you can pass the ticket number for the case created by the agent to Dynamics 365 Contact Center to link the case and load the customer summary for the representative to view.
Learn how to configure context variables for agents in Configure context variables for AI agents. But, before you configure context variables for agents, we recommend that you read the best practices for configuring them. Learn more in Best practices for configuring AI agents.
Learn how to use and send custom context in a conversation in Send custom context.
Related information
Integrate a Copilot Studio bot
Integrate an Azure bot
Configure context variables for bots
Configure bots to escalate and end conversations
Best practices for configuring bots