Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

OR Filter on two entities

(0) ShareShare
ReportReport
Posted on by 40

I need to retrieve a set of records based on a search on two different fields in two different entities. The search value can exist in either field for the record to be returned.  Do I have to use FetchXML for this?  I tried variations on the below for this with no luck.

jobopportunities?$select=createdon,_account_value,addcoresafety,directions,duration,jobaddress,jobtype,_list_value,name,neededemployees,positiontitle&$expand=account($select=name;$filter=contains(name, 'foo'))&$filter=contains(positiontitle, 'foo')

  • Guido Preite Profile Picture
    54,077 Moderator on at
    RE: OR Filter on two entities

    afaik not possible directly with a single query, you can eventually get all the records from a query where the condition is on the secondary entity (like the account name on your query) and after filter the result checking if your first condition is applied or not on your primary entity.

    EDIT: thinking again, probably you will need to do a query getting all the results (so no conditions on the secondary entity, just retrieve all the records) and after check both conditions. I am talking when there is a relationship that connect both entities (like "jobpportunity" and "account" in your example query) and this relationship is bound to the records you want to retrieve (just to clarify, if you want to check accounts with your condition that are not related to jobopportunity, then you must do two separate queries)

    hope it helps and sorry for the confusion.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 97

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans