web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get and Set Lookups from a related entity using Javascript CRM

(0) ShareShare
ReportReport
Posted on by

Hi all!

I have this request in Account Entity, where if user enters a Zip/Postal (Lookup Field) , the form auto-populates the Region number (Lookup) and County number (Lookup)  base on the Zip/Postal. Relationships are already set in CRM. I've done this using Plugin and it's a success, but it needs to be real-time. So it need to be done uisng JS and I'm not quite good with Javascript. Can anyone provide me a code structure for this? I'm using CRM 2013


Thanks in advance!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rawish Kumar Profile Picture
    13,758 on at

    Hello There,

    I would suggest you install and use the CRM restbuilder. It will let you create odata request.  [View:https://github.com/jlattimer/CRMRESTBuilder/releases:750:50]  

    once you install this you will be able to access this tool from solutions are.

    basically this is what you need to do.

    1. select the endpoint as 2011 ( odata)

    2. select the retrieve multiple option

    3. select the entity you need to retrieved

    4. add filtering attributes in this case it will be your zip/postal code.

    and generate the code. later you can use the retrieved value to set on the current form by using Xrm.Page.getAttribute("fieldname").setValue(retrievedValue);


    and that's how you set lookup value : passion4dynamics.com/.../how-to-retrieve-lookup-value-and-set-it-on-another-lookup-field-in-dynamics-crm-2016-javascript

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi,

    User CRMRestBuilder to build the query -

    www.youtube.com/watch

    Here I have answered similar requirement , you can have a look -

    community.dynamics.com/.../304043

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans