Manage context variables

Omnichannel for Customer Service offers a suite of capabilities that extend the power of Dynamics 365 Customer Service Enterprise to enable organizations to instantly connect and engage with their customers across digital messaging channels. An additional license is required to access Omnichannel for Customer Service. For more information, see the Dynamics 365 Customer Service pricing overview and Dynamics 365 Customer Service pricing plan pages.

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 agent 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

  1. Go to one of the admin apps, and perform the following steps:

    • In the site map, select Workstreams in Customer support and open a workstream from the list.
  2. Select Add context variable in the Advanced settings section of a workstream.

  3. In the Edit pane, select Add, and enter Name. Make sure that the variable name is less than or equal to 100 characters.

  4. Select the Type of variable from the dropdown list. You can choose either Text or Number.

  5. Repeat steps 3 and 4 to create the required variables.

Configure context variables for Azure and Copilot Studio bots

You can also configure context variables for Azure and Copilot Studio bots in Omnichannel for Customer Service. 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 bot to intelligently provide contextual responses to resolve customer issues in a quick and efficient manner. For example, the bot 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, the pre-conversation information, custom context, or recent pages browsed on a website by the customer can be passed on to the bot by configuring context variables for the bot. Context variables set by the bot can also be passed to Omnichannel for Customer Service when the bot escalates to the human agent. For example, you can pass the ticketnumber for the case created by the bot to Omnichannel for Customer Service to link the case and load the customer summary for the agent to view.

To configure context variables for bots, see Configure context variables for bots. But, before you configure context variables for bots, we recommend that you read the best practices for configuring bots. More information: Best practices for configuring bots

To learn about using and sending custom context in a conversation, see Send custom context.

See also

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