web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to use Filter condition on related entity using CRM Web API

(1) ShareShare
ReportReport
Posted on by 2,715

Hello ,

     I want to get all the account records based on my primary contact  GUID .So i want use the WEB API ,can i filter my result sets based on my contact GUID?If so then how filter on multiple GUIDs,do i need to use the contains operator or IN Operator or Equal operator with multiple or condition

SQL Replica of my Query is 

Select * from Account where primarycontactid in('GUID1','GUID2','GUID3')

Thanks in Advance

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brad Sprigg Profile Picture
    985 on at

    You should be able to use something like

    $filter=primarycontactid eq GUID1 or primarycontactid eq GUID2 or primarycontactid eq GUID3

    See msdn.microsoft.com/.../gg334767.aspx

  • Suggested answer
    Anirban Dutta Profile Picture
    5 on at

    I believe it must be something like the below:

    ?$select=<your select query>&$filter=primarycontactid/contactid eq GUID1 or primarycontactid/contactid eq GUID2 or primarycontactid/contactid eq GUID3

    In general "primarycontactid" field must be schema name of the lookupfield and contactid is the actual primaryguid in the related table, which in this case is the contact entity.

    Hope this helps!

  • Pavan Deepala Profile Picture
    90 on at

    Thanks

  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    You can use CRM REST builder to create query and add filters also you can test your Web API query .

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans