Extend D365 Customer Service Copilot: Ask questions about your data(verse)

Earlier this month I posted an article on how you can extend the Copilot that sits inside of Dynamics 365 Customer Service by using Prompt Plugins. If you haven’t had a chance to read that article yet, then you can do so here. In the article I explained how you can create prompt plugins in Copilot Studio which are then surfaced inside of Dynamics 365 Customer Service as a Plugin for generative AI. Administrators can enable these plugins from within the Customer Admin Center app for Dynamics 365 Customer Service, after which they then become available for agents. There is nothing the agent needs to do to use the plugin, the system will automatically access the plugin based on the information that is entered in Copilot in Dynamics 365 Customer Service. The example I used in that article (and video) was pretty simple, so I wanted to write another article so I can show you an example of other things that you can do with these prompt plugins. This will also show you the importance of how you configure your prompt plugin.

What does it do?

The way I am going to configure this plugin will allow users to ask questions about a custom table and its related tables. This is very different from the scenario I showed you in my previous article, where I really only asked one question! I wanted to have a little fun with this, so I have loaded some movie data in my Dynamics 365 Customer Service instance. Once the prompt plugin is created, users can then ask questions about movies and the actors that play in the movies. NOTE: I could have created additional tables if I wanted to, for example a table for the director that holds director specific details, but I decided to leave it at 2 tables for this example. I also could’ve used any of the system tables instead of creating custom tables.

Dataverse Tables

To allow users to ask questions about movies and actors, I first need to create the Dataverse tables to store this information. I created three tables in Dynamics 365: The first table is called ‘Actor’, the second is called ‘Movie’ and the third is called ‘Role’. The ‘Actor’ table has details about actors, such as their name, their age, first movie they performed in and a date field that tracks the date they were active as an actor called ‘active since’. The ‘Movie’ table has (as you probably expected) data related to movies. I have columns to store the movie name, name of the director, and the movie’s release date. The ‘Role’ table represents the role the actor played in a movie. It has a name field to capture the name of the role/character the actor played and lookups to the ‘actor’ and the ‘movie’ tables. After I created and published the tables, I needed to import the rows into Dataverse, otherwise the Copilot in D365 Customer Service won’t be able to answer the user’s questions! After I import the data into my custom tables in Dataverse I can create my prompt plugin in Copilot Studio!

Create Prompt Plugin

Once logged into Copilot Studio, I click on the ‘Library’ icon on the left side of the screen. This shows you a list of all plugins and prompts that are in your environment. From here I click the ‘+Add an item’ button, after which a screen pops up asking me which Copilot I want to extend.

NOTE: Please keep in mind this is still in preview so I would not recommend trying this in a production environment. Since we can also not delete any of these plugins we’re creating here, I would recommend creating a new environment to try this in. Click on Copilot in Dynamics 365 Customer Service, which will open Copilot in Dynamics 365 Customer Service. From here I can click on the ‘+Add action’ visible on the front page, or I can navigate to the ‘Actions’ tab and add the action from there. This brings up the ‘New action’ window which allows me to choose to create a connector or a prompt action. I click on ‘Prompt’ on the right side of the screen, which then loads the prompt window. For the title I choose ‘Move Buff’ and in the prompt section I enter ‘You are a movie buff that answers questions on the following query:‘. Now I need to create my input variable, which represents the question the user will be asking. Under ‘Prompt settings’ I click ‘Input’ and then ‘+Add input’. Under ‘Name’ I enter ‘Question’ and for testing purposes I enter ‘Which movies came out in ‘ below the ‘Sample Data’ field. To add the variable to the prompt I click on the ‘Insert’ button and select my previously created ‘Question’ variable. The next step is to add the Dataverse tables I want Copilot to use. I expand the ‘Data used(preview)’ section on the right side of the screen and click ‘Add data’. In the ‘Select a data source’ window I search and select my custom ‘Role’ table. We can only select one table from here, but that is fine, because we will be able to get data from the related ‘Actor’ and ‘Movie’ tables because they have a relationship to the ‘Role’ table. I am not entering anything in the ‘Filter attribute’ field, because I don’t want to filter any of the data in the table. The next sentence I enter in the prompt window is: ‘Your answers should be formatted as a list, and you have access to the following data points in your response:’.

After I enter the sentence, I will add the columns from my custom tables, this can be done by clicking the ‘+ Insert’ button again and selecting the ‘Role’ table. From here I select the ‘Character Name’ and ‘Role’ columns. Since I also want Copilot to be able to answer questions about the movies and the actors, I will need to bring these in as well. I can do that by clicking on the ‘+ Insert’ button again and scrolling down until I see the ‘Actor’ table. After I click on the ‘Actor’ table I now have access to the columns of that table. I add the following columns: ‘Actor’, ‘Active Since’, ‘Age’, and ‘First Movie’. Unfortunately, I can’t select them all at once, I have to select and add them one by one. Now I will add the columns in the ‘Movie’ table. I do this by clicking on the ‘+Insert’ button and searching for and clicking on the ‘Movie’ table. The columns I add are: ‘Name’, ‘Director’, and ‘Release Date’. I am now ready to test my plugin! You can change the question you want to test, in the ‘Sample Data’ field below the ‘Input’ section on the right side of the screen. Clicking ‘Test Prompt’ will populate the response below the prompt. Some of the questions will depend on the data you have in the tables, but below are some examples I used for testing:

  • Which movies came out between 1993 and 1995?
  • Who played in demolition man?
  • How old is Sandra Bullock?
  • What is the name of the first movie Sandra Bullock played in?
  • Which movies did Arnold Schwarzenegger play in?
  • Who directed Pulp Fiction?

Since everything looks good, I can click the ‘Finalize prompt’ button. This takes me to the next screen from where I can create the prompt section.

Enable the Prompt Plugin in D365 Customer Service Admin Center

Before I can start using the prompt I just built inside of Dynamics 365 Customer Service, I need to enable it, I can do this by logging into the Customer Service Admin Center app. Once I open the app, I navigate to ‘Productivity’, which is below the ‘Agent Experience’ section on the left side of the screen. I see ‘Plugins for generative AI (preview)’ in the list of features. Click ‘Manage’ to access them. I can see my newly created plugin in the list. Select the plugin and click the ‘Turn On’ button on the command bar. The ‘Manage User Access’ window opens, where I can select which agents should have access to the plugin. You can give access to all agents, or to agents that have specific security roles. When I click the ‘Next’ button it opens the ‘Define Inputs screen, which I leave blank, because my tables are not associated with the case table. After clicking the ‘Next’ button again I can turn on the plugin. I hope you enjoyed this article! Be sure to check in again next week for a new article or subscribe here to never miss another post!


Share this!

Comments are Closed