Call an action to pull in Dataverse for Teams data

Completed

With the Call an action node, copilots can interact with Power Automate flows. You can use these flows to trigger automated processes or connect with Dataverse for Teams data, Microsoft Lists, or other data sources.

For example, the Event Contacts copilot could provide the Sales Project team members from a Dataverse for Teams table. Instead of editing the copilot when changes are made to this team, you can update the table.

Step 1 - Create a Dataverse for Teams table

To create a Dataverse for Teams table, follow these steps:

  1. Create a new Dataverse for Teams table in the same team as the copilot. Remember that you'll need to create it by using Power Apps for Teams. In Power Apps for Teams, select the Build tab, and then select your Team.

  2. Select See all below the Items created for [your team name], to bring up the Team Solution list. The Team Solution list includes all of the Apps, copilots, Cloud flows, Tables, etc. that have been built in Dataverse for Teams for the selected Team. If you've selected the same Team that you created your Event Contacts copilot in, you'll see it in the Solution list.

  3. From the Team Solution ribbon at the top, select New > Table.

    Screenshot of the Build tab with new menu and table selected.

    Name your new table Sales Project Team and select Save. The columns and data types to use are as follows:

    Column Data type
    Name Text
    Email Address Email

    You'll need to add the Email Address column to your table before continuing to the next step.

  4. Add new rows for each of the four contacts.

    Name Email Address
    Joseph Price JosephP@contoso.com
    Nathan Rigby NathanR@contoso.com
    Amber Rodriguez AmberR@contoso.com
    Monica Thomson MonicaT@contoso.com
  5. When complete, return to Microsoft Copilot Studio for Teams.

Step 2 - Create a copilot topic with an Action step

To add an action, follow these steps:

  1. In Microsoft Copilot Studio for Teams, select the Copilots tab from the ribbon, then find/select your Event Contacts copilot to open it.

  2. Go to your list of Topics.

  3. Create a new topic by selecting New topic > From blank from the Topics ribbon. To name the topic select Details from the ribbon. Enter "Sales Project Team" into the Name field.

  4. Select Trigger phrases and enter each of the following, press + after each entry:

    sales project team

    sales project info

    sales team info

    sales project members

    sales project info

  5. On the authoring canvas inside the Message node, enter:

    Let me look up the Sales Project Team!

    Screenshot of the setup with the name and trigger phrases.

  6. Now, select the Save button from the ribbon to save your topic. Any changes that you haven't saved at this point could be lost when you switch to Power Automate to create the flow.

  7. Add a new node after the Message node and then select Call an action > Create a flow. Copilot Studio might present you an option box to remind you to save your topic before leaving. If you've already saved it, select Leave. This action opens the Power Automate studio inside of Copilot Studio.

    There are some common templates available to immediately choose from. Each template allows you to pass information to the flow when it's triggered. As the flow finishes, it can pass information back to the copilot. If you want to look at some more template options, you can select See more templates. Some notables include:

    Power Virtual Agents Flow Template - This template only has the steps to receive and send information to the copilot.

    Send a message to a Teams channel - Trigger a Teams message from the copilot.

    Send an adaptive card to a Teams channel - Trigger an adaptive card to provide information into a Teams channel.

  8. Select the one called Power Virtual Agents Flow Template. As you do, your trigger will be Power Virtual Agents and you'll have one step below it called Return value(s) to Power Virtual Agents.

  9. Rename the flow to Get Sales Team Members.

  10. Create a variable to hold the information that you want to provide back to the copilot. Between your trigger and the return value step, move your cursor to the arrow and select the Insert new step icon that appears when hovering in that space and select Add an action.

  11. In the search box, enter "variable" and then, under Actions, select Initialize variable.

  12. Enter "varContactInfo" for the Name and then select String for the type. Leave the Value blank.

  13. Now we need a step to access the data from Dataverse from Teams. Under your new Initialize variable step, select the Insert new step icon, and select Add an action. Search for the Microsoft Dataverse connector then select List Rows as the trigger.

  14. For Table name, select the Sales Project Team from the dropdown. (You can input "sales" in the input field to quickly filter the list.)

    The List rows action pulls all table rows into an array. An array is a table. To add data to our string variable, you need to go through each row of the table add each row of data to your varContactInfo variable. That's the way we'll pass this data back to Power Virtual Agents.

  15. Select the Insert new step icon after List rows. Select Add an action.

  16. In the search box, enter Control and then, under Actions, select Apply to each.

  17. In the Select an output from previous steps field, select it to add Dynamic content. Then select value from under the Dataverse List rows action.

  18. Select Add an action within the Apply to each step to continue.

  19. In the Choose and operation search box, enter variable and then, under Actions, select Append to string variable.

  20. In the Append to array variable step select varContactInfo for the Name.

  21. For the Value, we're going to create a multi-line bulleted list (as string data) with the name and email of each person. Power Automate uses Markdown syntax when formatting text. To indicate a bulleted list in Markdown, you'll use the asterisk character * at the line's start. (To learn more about Markdown, see the Summary section at the end of this module.)

    In the Value text box:

    1. Enter an asterisk * and then add a space.

    2. Under dynamic content List rows, select Name and then add a space.

    3. Under dynamic content List rows, select Email Address.

    4. Press Enter to start a new line.

    We're done with this step.

  22. Select the Return value(s) to Microsoft Copilot Studio step at the bottom of the flow, and then select + Add an output.

  23. Select Text as the type of output.

  24. In the Enter Title text box, enter ContactData.

  25. For the Enter value to respond field, select the input field and then select varContactInfo under the Variables section.

    Your flow should now resemble the following image:

    Screenshot of the Get Sales Team Members flow.

  26. Select Save from the Power Automate ribbon to finish editing the flow. Power Automate automatically runs the Flow Checker to look for problems. You might see a warning about "...OData filter queries..." but you can ignore that. You can use OData filters to limit the data that your List rows step pulls back, but we have only a few rows in our data source so a filter is unnecessary. Select Close to exit Power Automate and return to the copilot editor.

  27. Back in your Copilot chatbot editor, look at your Action step. You should see the flow you just created: Get Sales Team Members as the action, and the ContactData string variable that you created listed as an output.

  28. Add a Show a message step after the Action node.

  29. Click inside the text box to bring up the menu. Select ContactData under Insert variable {X}.

  30. Select Save from the Topic editing ribbon and wait for the topic to save. If the Test bot pane isn't visible, select the Test bot menu option.

  31. At the top of the Test chatbot panel, ensure that the Tracking between topics option is toggled on.

  32. Enter one of the trigger phrases to test your Sales Project Team chatbot. Your test chatbot will provide a bulleted list of the four names and email addresses of your Sales Project Team.

    Screenshot of the Sales Project Team topic.

Congratulations! You've now created a way for your Copilot chatbot to reach for information from data tables via an integrated Power Automate flow.