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)

Getting Value from a record in a lookup field

(0) ShareShare
ReportReport
Posted on by

Hi all,

I'm beginner in CRM dynamic, i need to retrieve value from a column field which inside a record and the record is been call from lookup field.

Anyone there might have idea how to do it ?

Thank for the help!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    11,401 on at

    You want to get from JavaScript within the form?

    lookupFieldObject = Xrm.Page.data.entity.attributes.get('entityid');
        if (lookupFieldObject.getValue() != null) {
            entityId = lookupFieldObject.getValue()[0].id;
            entityName = lookupFieldObject.getValue()[0].entityType;
          entityLabel = lookupFieldObject.getValue()[0].name;
        }

  • Verified answer
    CRASH Profile Picture
    2 on at

    Hi,

    1) Use Xrm.Page.getAttribute("FieldName").getValue(); to get lookup value, Extract ID from the object returned.

    2) http://www.inogic.com/blog/2015/12/execute-fetchxml-using-web-api-in-dynamics-crm-2016/
    Call fetchxml(get from Advanced Find) using above or similar approach, to fetch that record you are looking for, pass ID extracted from above step, you'll get a single record, which would contain whatever data you require(mentioned in fetchXML)

  • Suggested answer
    Mihir Maruti Kadam Profile Picture
    702 on at

    You can create and add a quick view on your form. Access data of quick view form using JS method Xrm.Page.ui.quickForms.get("<QuickViewControlName>");

    msdn.microsoft.com/.../mt736908.aspx

  • Community Member Profile Picture
    on at

    Hi,

    this might be most toward my question with example, thank for the help, but the fetch xml seem a little bit complicated for me as a beginner to understand.  so i might using SDK.REST.retrieveRecord function to get value i needed.

  • Community Member Profile Picture
    on at

    Xrm.Page.ui.quickForms.get here I'm getting error and  Xrm.Page.ui.quickForms as null even I have placed QuickViewform on Form. and used msdn.microsoft.com/.../mt736908.aspx Also. I registered my javascript method on change of lookup and tried with onload too.

    Thanks in Advance.  

  • l ringel Profile Picture
    on at

    Will this help me retrieve any field within that lookup record?

    I want to run a script on load of a form that checks the value of a custom field of the related lookup record.

  • Community Member Profile Picture
    on at

    Hi,

    You can use Odata query to get data you want. i attach URL link below so that you can have some example or knowledge about the query.

    https://community.dynamics.com/crm/b/crmandunifiedservicedesk/archive/2017/04/13/javascript-odata-query

    https://dynamicscrmgirl.wordpress.com/2014/01/04/crm-2013-javascript-retrieve-record-using-odatarest-endpoint-without-jquery/

    Cheers,

  • Saddamk206 Profile Picture
    777 on at

    Hi,

    try these:-

    var Id = Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].id;

    var Name = Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].name;

     

                             or Can Use if not work(Use window.parent. before Xrm)

    var Id = window.parent.Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].id;

    var rName = window.parent.Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].name;

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