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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Field Values Return Undefined

(0) ShareShare
ReportReport
Posted on by 958

Scenario:- I am trying to retrieve the data using CRM Rest Builder for Two Fields TypeOf "1) Look-Up(Account Manager) and  2) PickList(Account Status)".

How could i display the Red Colored field value in a HTML Page?

When i am going to display them in a html page then these fields are return the following and i want to display the Red Colored Field value but it

shows the Blue Colored Field Value:- 

1) Account Manager(Look-Up) 

_new_accountmanager_value@OData.Community.Display.V1.FormattedValue:"Nick Salamone",

_new_accountmanager_value@Microsoft.Dynamics.CRM.lookuplogicalname:"systemuser",

_new_accountmanager_value:"21c5bf54-0359-464b-9cb9-9a2af4783201",

2) Account Status(PickList)

new_accountstatus@OData.Community.Display.V1.FormattedValue:"COD - Loaners",

new_accountstatus:100000005,

Code:-

var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/accounts()?$select=_new_accountmanager_value,new_accountstatus", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var result = JSON.parse(this.response);
var _new_accountmanager_value = result["_new_accountmanager_value"];
var _new_accountmanager_value_formatted = result["_new_accountmanager_value@OData.Community.Display.V1.FormattedValue"];
var _new_accountmanager_value_lookuplogicalname = result["_new_accountmanager_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
var new_accountstatus = result["new_accountstatus"];
var new_accountstatus_formatted = result["new_accountstatus@OData.Community.Display.V1.FormattedValue"];
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Shakti Singh Rajput Profile Picture
    958 on at
    RE: Field Values Return Undefined

    Sorted No worries.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
UllrSki Profile Picture

UllrSki 2

#1
Community Member Profile Picture

Community Member 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans