Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Get the lookup field guid so I can set the value from javascript

Posted on by Microsoft Employee

So I currently have a API which does address validation and the account form contains a state lookup control. I want to be able to change the state lookup value from my API result, however I need the GUID of the state lookup field I'm trying to change to. I currently have a array of GUIDs hardcoded to the state lookup fields and this isn't a robust solution. How can I get GUIDs of the lookup fields so I can change the values? Example: The value GA is the value displayed before the api call and than it returns FL. I cant set the value of FL because I don't have that lookup field guid but I have the guid of GA.

*This post is locked for comments

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Get the lookup field guid so I can set the value from javascript

    Hello,

    I believe that you created custom entity that contains the list of your states. Based on this assumption I can suggest to build JavaScript code that will retrieve state based on the name using WebApi. To make it faster you can use RestBuilder tool - github.com/.../2.5.0.0

  • Suggested answer
    prt33k Profile Picture
    prt33k 6,907 on at
    RE: Get the lookup field guid so I can set the value from javascript

    Hi,

    You need to make webAPI call to retrieve the GUID of FL from CRM and then set it. Something like this will help:

    community.dynamics.com/.../ms-crm-2016-web-api-operations-retrieve-single-or-multiple-records

    Thanks,

    Prateek

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans