Retrieve Access Team Members using FetchXML in CRM 2013/2015

Hi,

Today we got a requirement to fetch the users who are added on the Access Team of the record and do some operation.

Here is the Fetch XML to retrieve the users that were added to access team.

I was using for Order entity. If you are using for any other entity, you need to change the entity name in the 2nd line and ID schema name in the 4th line of the Fetch Xand pass record Id in the filter condition.

public static void GetAccessTeamMembers(IOrganizationService iService)
{
      string strFetchXML = @”
                             <entity name='salesorder‘ >
                              
                                   <link-entity name='principalobjectaccess' from='objectid' to='salesorderid‘ link-type=’inner’ alias=’poa’ >
                                     
                                     
                                       
                                         
                                       
                                       
                                         
                                           
                                        
                                      
                                      
                                     
                                      
                                          
                                   
                                 
                                ;

      EntityCollection entColAccessTeamMembers = iService.RetrieveMultiple(new FetchExpression(strFetchXML));

}

Hope this helps.


Happy CRM’ing

Gopinath

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s