Call an action to pull in Dataverse for Teams data
With the Call an action node, agents 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 agent could provide the Sales Project team members from a Dataverse for Teams table. Instead of editing the agent 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:
Create a new Dataverse for Teams table in the same team as the agent. 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.
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, agents, 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 agent in, you'll see it in the Solution list.
From the Team Solution ribbon at the top, select New > Table.
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 |
You'll need to add the Email Address column to your table before continuing to the next step.
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 When complete, return to Microsoft Copilot Studio for Teams.
Step 2 - Create an agent topic with an Action step
To add an action, follow these steps:
In Microsoft Copilot Studio for Teams, select the Agents tab from the ribbon, then find/select your Event Contacts agent to open it.
Go to your list of Topics.
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.
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
On the authoring canvas inside the Message node, enter:
Let me look up the Sales Project Team!
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.
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 agent. If you want to look at some more template options, you can select See more templates. Some notables include:
Copilot Studio Flow Template - This template only has the steps to receive and send information to the agent.
Send a message to a Teams channel - Trigger a Teams message from the agent.
Send an adaptive card to a Teams channel - Trigger an adaptive card to provide information into a Teams channel.
Select the one called Copilot Studio Flow Template. As you do, your trigger will be Copilot Studio and you'll have one step below it called Return value(s) to Copilot Studio.
Rename the flow to Get Sales Team Members.
Create a variable to hold the information that you want to provide back to the agent. 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.
In the search box, enter "variable" and then, under Actions, select Initialize variable.
Enter "varContactInfo" for the Name and then select String for the type. Leave the Value blank.
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.
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 Microsoft Copilot Studio.
Select the Insert new step icon after List rows. Select Add an action.
In the search box, enter Control and then, under Actions, select Apply to each.
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.
Select Add an action within the Apply to each step to continue.
In the Choose and operation search box, enter variable and then, under Actions, select Append to string variable.
In the Append to array variable step select varContactInfo for the Name.
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:
Enter an asterisk * and then add a space.
Under dynamic content List rows, select Name and then add a space.
Under dynamic content List rows, select Email Address.
Press Enter to start a new line.
We're done with this step.
Select the Return value(s) to Microsoft Copilot Studio step at the bottom of the flow, and then select + Add an output.
Select Text as the type of output.
In the Enter Title text box, enter ContactData.
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:
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 agent editor.
Back in your agent 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.
Add a Show a message step after the Action node.
Click inside the text box to bring up the menu. Select ContactData under Insert variable {X}.
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 your chatbot menu option.
At the top of the Test chatbot panel, ensure that the Tracking between topics option is toggled on.
Enter one of the trigger phrases to test your Sales Project Team agent. Your test agent will provide a bulleted list of the four names and email addresses of your Sales Project Team.
Congratulations! You've now created a way for your agent to reach for information from data tables via an integrated Power Automate flow.