Have you ever wondered how you combine the power of a chat bot with data in Dynamics 365 for Finance and Operations (D365F&O)?
Wonder no more because with Power Virtual Agents you can!
In this series of blog posts I will take a look at how it is done and present you with an example. The series will consist of a number of separate posts exploring the following topics:
- This post. An introduction to the Contoso Customer Service Bot and the Power Virtual Agent tool set.
- How to use Power Automate flows to connect to D365F&O and provide rich contextual conversations.
- In the last post we will take a look at how you embed the bot in Microsoft Teams.
What is a Power Virtual Agent Bot?
Basically, a Power Virtual Agent Bot (PVAB) is a chat bot that is trained to respond to predefined topics (phrases) in a pre-configured flow. The PVAB flow consists of a number of components placed in a logical structure that leads the user through a task by asking questions and responding to user input.
In the above example I am using the opening phrase “new order” to start the conversation with the bot. In response, the bot has been configured to ask for my customer number.
In response to the customer order number I entered (“us-017”), the bot uses a Power Automate flow with a D365F&O connector to look up the customer. In this case, the customer account was found and the bot responds with a new question:
“What product would you like to buy?”.
In this example, I have set up a Power Automate flow that allows the user to look up the product using either the product number or the search name.
When I enter the product number “c0007” the bot calls the Power Automate flow that looks up the product and responds with the product name. The user is asked whether they would like to add the product to an order.
If the answer is yes, the bot continues by asking how many pieces the customer wants:
Once the customer enters a quantity, the bot calls a Power Automate flow that creates a new sales order and adds 5 pieces of iPhone 11 to the order in D365F&O. It returns the sales order number so the bot can inform the customer for future reference.
The bot flow has now ended successfully.
Please note: At any stage in the flow, you can pass the user to a chat experience with a customer service agent (person) through Dynamics 365 Customer Service.
Power Virtual Agent Configuration
In the following we will take a quick look at some of the core concepts in creating a PVAB bot.
I will strongly encourage you to follow the tutorial available when you create your first bot. More documentation is available here.
Create a Bot
To create a new bot in the PVAB home, click on the
icon in the ribbon at the top. This brings up the following dialogue where you give the bot a name and select the environment where you would like to place the bot.
Once you have created your bot, you need to define topics that will start a bot flow. In my bot example, I have two topics:
- Address Change.
The topics give the customer the possibility to create an order (see example above) or change address.
In the above example, I have opened the Ordering topic. For this topic, I have defined 11 phrases that will trigger the flow. If the user enters any of these phrases in the chat window, the ordering bot flow will start.
Bot Authoring Canvas
Once you have defined the trigger phrases for a topic, you click on
to start defining the bot flow.
The following screenshot shows the canvas for the first part of the Ordering topic:
The Trigger Phrases component is mandatory and automatically created.
As mentioned, I will encourage you to use the tutorial to familiarize yourself with the various component types in the canvas. However, I would like to show you a few in my example:
The above shows how the bot asks a question to retrieve the customer number. The input is stored in a variable called CustomerNumber. It subsequently uses the customer number variable as input to the Sales Bot Find Customer flow (in Power Automate). The flow looks up the customer in D365F&O and responds with ResponseCode (used to tell the customer if the account was found or not), ResponseName (customer name) and ResponseId (sales order number).
The following screenshots shows the components in the Power Automate flow:
I hope the above has motivated you to go and create your first bot in Power Virtual Agent. In the next blog post, I will take a closer look at the interaction between the bot and D365F&O through Power Automate.
Final Note: Since a PVAB can be embedded using HTML, it can embedded directly in a D365F&O screen through the new iFrame control.