Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Retrieve parent entity lookup field value from javascript

(0) ShareShare
ReportReport
Posted on by 475

can any one suggest why iam not able to get new_area field in result of retrieverecord ?

new_area is lookup field in new_contry entity iam able to get new_name but not new_area do i miss anything here in select?

after retrieving record i want to set value to another lookup.

Xrm.WebApi.retrieveRecord("new_contry", contryid, "$select=new_area,new_name").then(
function success(result) {
if (result != null) {
//set text field

//set lookup field
if (result.new_area != null) {
var object = new Array();
object[0] = new Object();
object[0].id = result.new_area.id;
object[0].name = result.new_area.name;
object[0].entityType = "new_area";
Xrm.Page.getAttribute(new_area1).setValue(object);
}

*This post is locked for comments

  • Sai Yanamandra Profile Picture
    Sai Yanamandra 5 on at
    RE: Retrieve parent entity lookup field value from javascript

    Thank you very much for this clue. I was struggling with the same issue without knowing that I need to prepend column name with _ and append _ value for lookup columns. It works fine for me now

  • Verified answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Retrieve parent entity lookup field value from javascript

    Hi,

    You can check our sample here: http://himbap.com/blog/?p=2874

  • Verified answer
    RE: Retrieve parent entity lookup field value from javascript

    arunpotti.wordpress.com/.../how-to-retrieve-a-record-in-dynamics-365-online-v-9-x-using-javascript-webapi

    Please refer the above link, In this link they have retrieved contact field lookup.

    Hope it will help.

    Thanks,

  • dkrishna Profile Picture
    dkrishna 475 on at
    RE: Retrieve parent entity lookup field value from javascript

    tried but It says property does not belongs to entity

  • RE: Retrieve parent entity lookup field value from javascript

    Hi dkrishna

    You can try it with _new_area_value.

    Thanks,

  • dkrishna Profile Picture
    dkrishna 475 on at
    RE: Retrieve parent entity lookup field value from javascript

    its getting success but new_area field is not getting where as new_name field is showing in result.  . is that because of new_area is lookup field ?

  • Aric Levin Profile Picture
    Aric Levin 30,188 Moderator on at
    RE: Retrieve parent entity lookup field value from javascript

    Using developer tools F12, put a breakpoint on the line after function(success), and see if you ever hit that line.

    That will help pinpoint if the problem if the problem is with your api code of something else.

    Check the data in result, and if data exists, check the data in result.new_area.

    Hope this helps.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans