Skip to main content

In this post, we will look at how a Power Virtual Agent can lookup data in the Dataverse and answer questions intelligently to the person it is chatting with. We will go through a simple example where we display account data to the bot’s chatter.

First, let’s create a new virtual agent in the Dataverse environment we want to look up data. Go to https://web.powerva.microsoft.com/environments/ to access your bot. Then go to Topics and create a new topic:

Next, provide a name for the topic, and any trigger phrases. We will call the topic “All Accounts” and the trigger phrase will be “Show me all accounts”:

You will see the canvas below. Click on Add a node:

And select Create a new flow:

This takes us over to Power Automate to create the flow:

For this example, there are no inputs. Click to insert a new step, and select the List Rows Dataverse connector. For this connector, we will select the Accounts table, without any filtering:

Next, let’s create a variable called AccountsList. We will be appending to this variable all the accounts from our Dataverse connector. Leave the initial value as blank:

Now, let’s add an Apply to each control, and inside the control we will add an Append to string variable action. The input is the value from List Rows, and we can then pick the AccountsList variable and set its value to the Account Name from List Rows. Note we are putting a blank line after the Account Name so it looks cleaner on the output:

Finally, we will populate the step to output the account list to the PVA. We will set the name of the output variable here to accountslistoutput:

Save the flow and go back to the PVA authoring canvas. We now have the accountslistoutput variable.

And we can very simply output the variable in a Show Message:

Now let’s test the bot. Type in “show me all accounts” and we get back all accounts from our Dataverse!

In the next post, we will look at how the bot can ask questions and use the responses to lookup specific data in the Dataverse.

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.

 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET’S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

ABOUT CARL DE SOUZA

Source