Power Virtual Agent is a great piece of software, it makes a lot of people's dream (like mine) to create their own chatbot, real.

With this example, I want to share with you how you can use PVA (Power Virtual Agent) to create cases in your Dynamics 365 instance.

This can be either an external chatbot or an internal one, in any case, it is quite useful.

Let's get started

First of All, you need to create a virtual bot, if you don't have, one you can sign up for a 30 days trial for Power Virtual Agent.

Make sure you sign up for a trial on your existing Dynamics CRM instance.

Follow this article on how to Sign up for a trial.

Once you have a trial up and running, you need to create a new bot Topic.

The topics are usually the starting point of a chatbot. They specify the sentences that will trigger the bot, in our case, such sentences can be:

  • I have issues
  • I need to Open a Ticket
  • Request a support

Then you need to configure the chatbot logic.

For now, we will keep it quite simple by asking just four questions that request basic user information to create a case.

These are:

  • Name
  • Email
  • Subject
  • Description

For all four of them the settings are as follow:

Ask a Question - contains your bot's question

Identify - User's entire responses

Save response as - give a name for the object (Customer Name)

Each Question that requires input from the customer will need to save this input as an object that we will use later in CRM

Here are my examples:

  • Name - Customer Name
  • Email - EmailAddress
  • Subject - CaseTitle
  • Description - CaseDescription

Repeat the steps above for all the other three questions.

Next, we need to trigger an action that will create the case in Dynamics CRM, using the provided information.

Let's open Power Automate and create a new Workflow.

Before that, it is very important to mention that the Workflow must be in a separate solution in order to work.

Create a new Solution and make sure you are in the right instance!

The Workflow is quite simple but yep will require some JSON knowledge and APIs.

I will post the code here for the purpose of this article.

Let's take a look at this this is the hardest part.



    "properties": {

        "CustomerName": {



        "CustomerEmail": {



        "CaseTitle": {



        "CaseDescription": {





  • When Power Automate receives an HTTP request from Power Virtual Agent with the following properties CustomerName, CustomerEmail, CaseTitle, and CaseDesription (If you remember, this are actually the Objects that we've created when we were setting up the bot's questions).
  • Create a new Contact in Dynamics CRM - we are creating new contact as we are assuming that we don't have him in CRM, same like it will be if we receive an email and we use the Case Creation rule.
  • Now we are going to use some of the Properties received from the bot.

The organization will be our main one

Entity Name is Contact

Last Name - will be the CustomerName property.

If we are asking him to provide First and Last name then you will have both as a separate property received.

Email is the CustomerEmail property from the bot.

So far, we used half of the provided information. Now for the other half we need to create a case as it is related to a case.

Organization will be our main one

Entity Name this time is Case

Case Title will be the received Property called CaseTitle

Customer is a Contact (the one created from the previous step)

Customer Type make sure it is set to Contact

Description is the CaseDescription property

The last Step of the Workflow is to inform back the customer that a case was created, so we need to return the Case Number of the newly created case.

This time we need to select a Response option (since we are returning a response to the Power Virtual Agent

The response code is quite simple:


"CaseNumber": "CaseNumber option from the Create Case step"


We can save the Workflow and Proceed to the last setup.

Return back to the bot settings. After the last question, add a new step called Call an Action, and the Workflow that you've created will appear here, so just select it.

Note: if you don't see your WF, it means that is not created in a separate solution, or the solution that you've created is in a different instance.

Add all the inputs from the customer's conversation in the bot.

To complete your bot, add the final step for output, which will return to the customer the case number.

That's it!

Let's see how it looks in action.

This how the case looks in Dynamics CRM

You can develop this by requesting more information from the customer, checking case status and etc.

Feel free to share with me any suggestions on how to improve this bot, for future articles to help others.