Here we will take a very simple example to see how Power Virtual Agent be used along with Power Automate to interact with Dynamics 365 model-driven App
Basically, the user enters the case number (ticketnumber) in the chatbot to get the current status of the Case.
To begin with,
- Sign in / Sign up to create an account for Power Virtual Agents
- Sign in with your work email address.
- Name your bot and click on create.
Create a new Topic with Name as Case Topic and Trigger phrases as shown below and save it.
Click on Go
to authoring canvas
Add node Show a message
Next, add new “Ask a question” node, the bot will ask the user to enter the case number
Next, add a node “Call an action” to call the PowerAutomate (Flow)
Let us pause here and first author the Flow which we would be calling from this particular node.
To create the Flow, login to PowerApps portal https://web.powerapps.com/, select the Virtual Agent environment, here we have created a new Solution and created a new Flow inside that solution.
First add the trigger “When an HTTP Request is received” with the below request body, to take case number input from the user.
Then add Initialize Variable step, which will hold the output for the response.
Next, add the List records step to get the case’s status based on the case number.
Next add the condition step, for handling the scenario when the user enters the wrong case number.
The expression used for the Condition step.
The helpful posts
Next set the variable
For If Yes à
For If no, we are simple setting the value as “No case record found”
Lastly add the Response step, which returns the output through the variable.
The flow à
Save the Flow, and go back to authoring canvas of the Topic in the Power Virtual Agent.
Select the flow created in the Call an action node
Specify CaseNumber as the input
Select Show a message as the next node
Specify caseResult output as the value to be used inside the Message
Save the dialog and now let us test it.
This is how the entire conversation logic looks like for our case topic.
We can also add End the conversation node to it.
Next, we will see how to publish and deploy this bot.
Hope it helps..