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)

how to get entity logical name from the odataqueryresults

(0) ShareShare
ReportReport
Posted on by 1,680

set lookup onload of one of our form. Could not successfully get the metadata of the returned record in odataquery, Can anyone provide me some examples? I am not able to get entity logical name from the results..

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    The logical name is always the Schema Name in lowercase - and if you are using the OData endpoint, you can can remove the 'Set' at the end as well.

  • Royal King Profile Picture
    27,686 on at

    you should be able to get the logical name of the lookup value that returned from the odata using below script

    result.lookupattributename.LogicalName   //It will give you entity logical name

    result.lookupattributename.Id   // this will give you record Guid

    result.lookupattributename.Name  // This will give you name of the record.

    for example to get the primary contactid from the account record odata result

    result.PrimaryContactId.LogicalName  // this will return "contact"

    result.PrimaryContactId..Id   // this will return id of the contact record

    result.PrimaryContactId..Name // this will return full name of the contact

  • Drew Inc. Profile Picture
    1,680 on at

    Chitra,

    The result itself is a record for the lookup. I am trying to get something like result.LogicalName.. probably i need to hardcode that value as I don't see a way to retrieve it.

    Thanks

    Drew

  • Verified answer
    Royal King Profile Picture
    27,686 on at

    Odata result does not return entity logical name in the result. But you already have Schema name of the entity in odata query from that remove the string "Set" and convert remaining string to lower case that will give you logical name of the entity.

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