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)

Crm

(0) ShareShare
ReportReport
Posted on by 65

I have a guid value for an item in a entity, and I need to get values of one field from that entity.

How can I achieve this? Please help!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at
    RE: Crm

    You will need to use webapi. The following is a sample for retrieving a value from the user entity. Change the following using your id field and your entity.

    You can also download and use CRM Rest Builder to generate Web Api requests.

    function GetUserInfo(userId) {

      var clientUrl = Xrm.Page.context.getClientUrl();

      var req = new XMLHttpRequest();

      req.open("GET", clientUrl() + "/api/data/v8.2/systemusers(" + userId + "?$select=new_MyFieldName", false);

      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 customFieldValue = result["new_MyFieldName"];

          }

         else {

              Xrm.Utility.alertDialog(this.statusText);

          }

      }

    };

    req.send();

    }

    Hope this helps.

  • Samhitha Profile Picture
    65 on at
    RE: Crm

    Thanks , I will try this

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans