Think Dynamic, Do Dynamic Microsoft Dynamic CE | Powerapps || Dynamic CRM || Power Apps || Power Platform || Canvas App || D365CE

RETRIEVING ENTITY METADATA IN DYNAMICS 365 WITH JAVASCRIPT

 In this post, we will look at how to retrieve Entity Metadata in Dynamics 365 with JavaScript.

Let’s say you want to get the metadata for an entity.

var req = new XMLHttpRequest();

req.open("GET", Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.0/EntityDefinitions(LogicalName='account')", 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 results = JSON.parse(this.response);

            console.log(results);

        } else {

            Xrm.Utility.alertDialog(this.statusText);

        }

    }

};

req.send();

Running this, we get:

Read More

Share:

0 Comments:

Post a Comment

Dynamic 365

Talha Manzoor. Powered by Blogger.

Contributors

Ex-QB Mark Sanchez arrested, faces three possible charges

  Ex-QB Mark Sanchez arrested, faces three possible charges Former NFL quarterback and current Fox Sports broadcaster Mark Sanchez was arres...

Search This Blog

Design by - Blogger Templates | Distributed by Talha Manzoor

Social

pictory

No Thumbnail

No Thumbnail