[TIPS] How to get all users within specified team (N:N Relationship) through power automate /flow

 [TIPS] How to get all users within specified team through power automate /flow

The relationship between User and Team is N : N.

So, it's hard to list all users directly.  This article will show you a solution by using FetchXML.




Example:

Requrement:

Get all users of "Warehouse1" team.



Step 1: Get the specified team with the name "Warehouse 1".



Step 2:  Get all users of the above team through Fetch Xml Query.

   How to create the Fetch XML Query?  You may use XrmToolBox --> FetchXML Builder.

   Click to download XrmToolBox.




<fetch>
  <entity name="systemuser">
    <attribute name="fullname" />
    <link-entity name="teammembership" from="systemuserid" to="systemuserid" intersect="true">
      <link-entity name="team" from="teamid" to="teamid" alias="TeamGUID">
        <filter>
          <condition attribute="teamid" operator="eq" value="00000000-0000-0000-0000-000000000000" />
        </filter>
      </link-entity>
    </link-entity>
  </entity>
</fetch>

Copy above XML script to power automate flow,
Replace the teamid value 00000000-0000-0000-0000-000000000000 with the actual team GUID got from above step.



DEMO:



No comments:

Post a Comment