Integrate knowledge management in Dynamics 365 with Copilot agents
Applies to: Dynamics 365 Contact Center—standalone and Dynamics 365 Customer Service only
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.
Note
Copilot Studio bot is renamed as Copilot agent (agent or AI agent). Human agent is now renamed as customer service representative (service representative or representative). You might come across references to the old and new terms while we update the product UI, documentation, and training content.
Integrate knowledge management with a Copilot agent to use customized conversations. AI agents help answer questions, perform actions, and solve simple problems. This frees up your customer service representative's time to deal with complex issues that need human intervention.
Copilot Studio lets you configure AI agents with various topics and trigger phrases to automatically resolve questions posed by your customers on your portal page. Learn more in Copilot Studio overview.
You can integrate knowledge management with a Copilot agent by using either of the following ways:
- Search Dynamics 365 knowledge articles
- Power Automate flow template
Prerequisites
Dataverse search must be enabled for the integration. You must have a system administrator role to be able to enable Dataverse search. Learn more in Configure Dataverse search for your environment.
You must perform the following two steps before you begin the integration.
Create and publish knowledge articles to a portal created in Power Apps.
Set up your portal with the Power Apps portals feature before integrating knowledge management with the Copilot agent. Learn more in Use settings to set up knowledge management. Learn more about setting up your Power Apps portal in Power Apps portal documentation.
You can create and manage knowledge articles by setting the Internal field to No in the Microsoft Datverse Web API. Learn more in knowledgearticle EntityType.
Create a Copilot agent and a topic in it.
- Learn more about creating an AI agent in Create and delete Copilot Studio bots.
- Learn more about creating a topic in Create and edit topics in your Copilot Studio bot.
Use the Search Dynamics 365 knowledge article flow action
Perform the following steps if you want to integrate a Copilot agent with knowledge management using the Search Dynamics 365 knowledge articles action:
- Set connection references.
- Add the action to the Copilot Studio topic.
Set connection references
Knowledge management integrated with Copilot Studio solution uses the flow with connections, such as Content Conversion and Microsoft Dataverse. You must configure these connection references before turning the Search Dynamics 365 knowledge article flow action on.
Note
- If you have the Environment Maker role and can't see either the notification for connection references or the cloud flow, then you don't have the permission to update them. You must contact your system administrator or system customizer to set the connection references and enable the flow.
- When the solution is imported from a test environment to the production environment, you must again set up the connection references as a system administrator. Learn more about importing in Export and import bots using solutions.
To set connection references:
Go to make.powerapps.com.
Go to Solutions. The Solutions page displays a notification with a link to configure connection references.
Select the link. If you don't see the notification on the Solutions page, go to Default Solutions > Connection references.
Select the connections for Microsoft Dataverse and Content Conversion on the Connection references page.
Select Save and Close.
Go to Default Solution > Cloud flows and turn on Search Dynamics 365 knowledge article flow flow.
Add the action to the Copilot Studio topic
After you configure the connection references in make.powerapps.com, go to Chatbots > List and select the required AI agent. This will take you to the Copilot Studio portal where you can create a topic. Learn how to create an AI agent in Create chatbots from Power Apps.
You can create a topic with two question nodes for search text and filter, or you can configure the search integration to set up a fallback topic in case of an unrecognized search phrase. Learn more in Configure the system fallback topic in Copilot Studio.
If you're creating a topic with two question nodes, for the filter question node, the Copilot Studio author can provide a sample filter value; for example, statecode eq 3.
Perform the following steps to ensure that flow is properly configured and can now be replaced with Search Dynamics 365 knowledge articles action.
On the Copilot Studio portal, select Topics > New Topic.
Within the topic, create a question node to ask the user to search for the input text.
Create a question node for the filter and provide the sample filter value after you trigger the topic.
Select Add node (+) and select Call an action. Select Search Dynamics 365 knowledge article flow action.
Provide the input to the flow. An error might appear if the filter isn't provided to the flow.
Add a message node to show the results returned by the flow. Learn more in Render results.
Select Save.
Use the trigger phase and run the topic to verify the flow.
Tip
If your search doesn’t return any results, modify the search terms or filter conditions. You can also add a filter condition if required.
After the topic is configured, replace the Search Dynamics 365 knowledge article flow with the Search Dynamics 365 knowledge articles action. You can now configure any AI agent in the organization to access knowledge articles using the Search Dynamics 365 knowledge articles action.
Remove the filter question node. Learn more in Work with filters.
Update the message node with the output from the action and select Save.
Work with filters
- By default, the search is performed on the external published articles (statecode eq 3 and isinternal eq false). If you need to perform additional filtering, you can set the required filter query as the Filter (text) input variable.
- To check which filters you can use and the attributes of the knowledge article entity, go to knowledgearticle EntityType.
- To write a Dataverse search query using filters, go to Working with operators.
- To see filter conditions that aren't supported by Dataverse search, see Configure Dataverse search to improve search results and performance .
- To filter on a string attribute like keywords, append the string value to the search text.
Publish the changes
Learn more in Publish the latest bot content. Learn how to resolve errors during publishing in Troubleshoot.
Use the Power Automate flow template
Perform the following steps if you want to integrate a Copilot agent with knowledge management by using the Power Automate flow template:
- Create a flow using the template.
- Add the solution's flow to the Copilot Studio topic.
Create a flow using the template
Go to powerautomate.microsoft.com.
On the templates page, search for the Generate answers from Dataverse knowledge articles to Power Virtual Agent template.
Select Continue. You'll be redirected to the Power Automate flow template.
Save the template, and then select Solutions. You might be prompted with a message on which you can select OK.
Select New solution.
Enter a display name. The list of solutions includes every solution in your organization. Choose a naming convention that helps you filter to just your solution. For example, you might prefix your email to your solution name: johndoe-power-virtual-agent-knowledgesearch-fallback.
Select your publisher from the list of choices.
Accept the default values for name and version.
Select Create to complete the process.
In the list of solutions, select the solution you just created. It should appear at the top of the list. If it doesn't, search by the convention you used in step 6 to name the solution.
In the solution, select Add existing, and then select Cloud Flow from the list.
In the Outside solutions list, select your flow, and then select Add to complete the process. If there are several flows, look at the Modified column to find the most recent version.
Learn about managing Copilot Studio solutions in Export and import bots using solutions.
Add the solution's flow to the Copilot Studio topic
Open the browser with the authoring canvas.
Above the Message action box, select the connector, and select Call an action.
From the pop-up flow window, select the new flow named Generate answer from Dataverse knowledge articles for Power Virtual Agent. The new action appears in the flow.
To correctly set the input variable to the action, select Select a variable, and then select bot.UnrecognizedTriggerPhrase.
To return the knowledge article search results to the AI agent, go to Render results.
Render results
To return the knowledge article search results to the AI agent, follow either of these steps:
Use thumbnail cards to show the article. Learn more in Respond with cards.
Use the following sample code to render search results in adaptive cards.
#kbcardjson()
-
{
"type": "AdaptiveCard",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "Image",
"height": "35px",
"url": "https://th.bing.com/th/id/R4fbade037f8209666b06aa22641708fc?rik=ya%2bpnPJ41EFFMg&riu=http%3a%2f%2fmolnar-institute.com%2ffileadmin%2f_processed_%2fcsm_KnowledgeManagement_icon_forWebsite_bcda89676b.png&ehk=J%2bz2G15xtbJgd7ssSXo7X2q7LDLaMGl7EuGUSQU6P2s%3d&risl=&pid=ImgRaw",
"size": "Small"
}
],
"width": "auto"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "${json(virtualagent.jsonResult).articles[0].title}",
"wrap": true,
"size": "Large"
},
{
"type": "TextBlock",
"spacing": "None",
"text": "Last modified on ${json(virtualagent.jsonResult).articles[0].modifiedon}",
"isSubtle": true,
"wrap": true
}
],
"width": "stretch"
}
]
},
{
"type": "TextBlock",
"text": "${json(virtualagent.jsonResult).articles[0].description}",
"wrap": true,
"size": "medium"
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "View article in Dynamics App",
"url": "${json(virtualagent.jsonResult).articles[0].crmAppUrl}"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
Troubleshoot
If a dialog is cross-linked and is modified, you'll see a validation error on publish and Copilot Studio will block the publish. Learn more in Publish the latest bot content.
If errors exist while saving a topic, the Topic checker shows the impacted topics. Errors will prevent the AI agent from working and must be fixed before you can publish your AI agent. Learn more in Topic errors.
For more information on flow error codes, go to Error codes: Copilot Studio