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)

Access custom fields XRM

(0) ShareShare
ReportReport
Posted on by

Hi,

I have lookup fields (custom entities) on my form. I am trying to access custom properties of those lookups through XRM:

Xrm.Page.getAttribute("xxx").getValue()[0]

However I get JS error when accessing any custom field for entity "xxx":

Xrm.Page.getAttribute("xxx").getValue()[0].tag //tag - undefined



Am I missing something here, what is the proper way of accessing properties of lookup fields?

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Aileen Gusni Profile Picture
    44,524 on at

    Hi Ray,

    If this is a lookup field, you can only get its id and name and entity type as well.

    var lookup = new Array();

    lookup = Xrm.Page.getAttribute("attributenamexxx").getValue();

    if (lookup != null) {

       var name = lookup[0].name;

       var id = lookup[0].id;

       var entityType = lookup[0].entityType;

    }

    duanenapier.wordpress.com/.../getting-values-from-form-fields-in-javascript-crm-2013

    www.mscrmconsultant.com/.../get-and-set-lookup-value-using.html

    If you need to retrieve other properties or attributes from that lookup you need to do oData Query or additional JavaScript like using Rest, soap.

    Example:

    yeskanagaraj.blogspot.com/.../retrieve-lookup-field-data-in-crm-2013.html

    dynamicscrmgirl.wordpress.com/.../crm-2013-javascript-retrieve-record-using-odatarest-endpoint-without-jquery

    Hope this helps.

    Thanks.

  • Community Member Profile Picture
    on at

    That's why I couldn't find any examples for it.

    Thanks

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