Retrieving data based on Many-To-Many relationship

Apr 13, 2011 at 8:35 AM


While using this tool, I could not get REST endpoint for following retrieval scenario

I wanted to retrieve all the Role Names for the give SystemUserId, for this I selected first selected "RoleSet" and then under Many-To-Many relationship I selected "systemuserole_association". Now I wanted to put filter on SystemUserId which is attribute of Systemuserrole, however I dont see SystemUserid.

How can I set such query?



Aug 3, 2011 at 5:22 AM

You can achieve it by using this approach:

http://CrmServerName/OrgName/xrmservices/2011/OrganizationData.svc/SystemUserSet?$select=systemuserroles_association/Name,systemuserroles_association/RoleId&$expand=systemuserroles_association&$filter=SystemUserId eq guid'00e640c5-0f5e-e011-8149-0800279b1d7b'

which is basically using the SystemUserSet to filter on a particular user record using the $filter query option and then retrieving the related user roles that are assigned to that user using the $select and $expand system query options.