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 :
Microsoft Dynamics CRM (Archived)

odata query for filter on basis of value in a lookup field(not by guid)

(0) ShareShare
ReportReport
Posted on by

How to write odata query for filtering records on basis of lookup Title value (eg retrieve all records from employee which contains employee band lookup value equals "MANAGER BAND"  without using guid of "

MANAGER BAND" record )?

6825.community.png

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rajat Awasthi Profile Picture
    675 on at

    Hi Purnima ,

    You can retrieve both i.e name and Id of a lookupfield.

    also , to write your odata query you can download and install Odata Query Builder and generate your desired code.

  • Community Member Profile Picture
    on at

    Thanks for reply ...I use odata query builder but i am unable to bulild query for filter on the basis of lookup title

  • Rajat Awasthi Profile Picture
    675 on at

    Can you paste a screenshot here.

  • Community Member Profile Picture
    on at

    I attached the screenshot

  • Rajat Awasthi Profile Picture
    675 on at

    Hi Purnima ,

    Sorry but I don't think lookup will allow you to get record based on name.

    I suggest you to do this by retrieving the GUID for the Lookup and then retrieving the all the employees record.

  • Suggested answer
    Moh Helper Profile Picture
    250 on at

    Hi,

    Unfortunately for your case it's impossible via odata.

    You can make this example of odata query using with a lookup :

    /ContactSet?$select=FullName&$filter=ParentCustomerId/Name eq 'XYZ'

    But the limitation is that you can only query on a single Entity Type...

    Kr,

    Moh

  • Suggested answer
    Community Member Profile Picture
    on at

    Options as I see it:

    I'm assuming

    a. You have an entity named 'Title'

    b. You are using this entity like a category so there are not many records in it eg. MANAGER BAND

    1.

    Just create a subgrid within your 'Title' enties form with properties:

    -Data Source-

    Records: Only Related Records

    Entity: Employees

    Deault View: Active Employees

    Now when you click on the 'MANAGER BAND' record, a list of all the employees willl be displayed in this subgrid (employees which have MANAGER BAND as title lookup)

    2. Redesign your database schema

    3. Just use the {GUID}. There is only one GUID you need to get which you can get by filtering using advanced find - the GUID of your MANAGER BAND Title record will be displayed in the URL when you find and open it.

    Then run your ODATA query using that ID.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans