Categories: Dynamics CRM

Dynamics CRM: FetchXML to Retrieve Access Team Members

The very smart folks over at PowerObjects recently posted a blog article on how to retrieve the membership of an Access Team using SQL.

When working in CRM Online or when we need to use the query for a view we have to make our SQL statements work as FetchXML. Here is the FetchXML that will retrieve Access Team members. You can edit it for the desired entity and place filtering as appropriate. In this case, we are retrieving all the Opportunity records and User records for the Opportunity Sales Teams (CRM’s default OOTB example of Access Teams.)

<fetch>
  <entity name="opportunity" >
    <attribute name="name" />
    <link-entity name="principalobjectaccess" from="objectid" to="opportunityid" link-type="inner" alias="poa" >
      <attribute name="objectid" alias="objectid" />
      <link-entity name="team" from="teamid" to="principalid" link-type="inner" >
        <link-entity name="teamtemplate" from="teamtemplateid" to="teamtemplateid" >
          <attribute name="teamtemplatename" />
        </link-entity>
        <link-entity name="teammembership" from="teamid" to="teamid" link-type="inner" intersect="true" >
          <link-entity name="systemuser" from="systemuserid" to="systemuserid" link-type="inner" >
            <attribute name="fullname" />
          </link-entity>
        </link-entity>
      </link-entity>
    </link-entity>
  </entity>
</fetch>
Nicolas Nowinski

Share
Published by
Nicolas Nowinski

Recent Posts

With AI, Written Language Matters Most

I'm not 100% certain I love this article. I made myself write it in less…

3 months ago

Can AI predict weather? AI’s DC Snow Forecast

I had a little fun a few days ago having AI do some forecasting for…

3 months ago

What the snow? AI Chatbots Predicting DC Weather!

Can AI Chatbots predict DC snow weather? I decided to try it out by letting…

3 months ago

History Does Not Predict the Future

History is far less useful than many assume. It creates the illusion of predictability only…

3 months ago

10 Choices for a Better Future No Matter What Happens

I'm not a fan of traditional New Years Resolutions, as I wrote about here, but…

4 months ago

The Human Blind Spot Around Non-Deterministic Machines

Why LLM's will always make mistakes and we shouldn't call them hallucinations I saw a…

7 months ago