In Microsoft Dynamics 365 I needed to get a list of member’s email addresses in a team. To do this I had to use Fetch XML Query on a List Rows Action in Power Automate.

First I created a compose action to get the owner ID of your target entity (I am using Orders in my example)

Next I created a List Rows Action and pasted the xml from here

Here is the code if the website above is not working (Take note of condition value below, that will be your dynamic content):

<fetch mapping="logical" output-format="xml-platform" version="1.0" distinct="true">
<entity name="systemuser">
<attribute name="fullname" />
<attribute name="systemuserid" />
<attribute name="internalemailaddress" />
<order descending="false" attribute="fullname" />
<link-entity name="teammembership" visible="false" to="systemuserid" from="systemuserid" intersect="true">
<link-entity name="team" to="teamid" from="teamid" alias="ac">
<filter type="and">
<condition value="@{outputs('Compose')}" attribute="teamid" operator="eq" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>

After that I was able to pull the primary email address for each team member and store in an array to use for a send email action!

Reference:

https://powerusers.microsoft.com/t5/Building-Flows/Send-Email-to-Dynamics-365-Team-Members/m-p/464699#M55904
https://us.hso.com/blog/microsoft-power-automate-how-to-use-fetch-xml-inside-of-a-flow-to-query-cds-entities-and-get-data-from-related-entities/