web
You’re offline. This is a read only version of the page.
close
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')

I have the same question (0)
  • Guido Preite Profile Picture
    54,086 Moderator on at

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 96

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 69 Super User 2025 Season 2

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans