Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

get all entity metadata display names via javascript?

$
0
0

Hello, I'm creating a Js so that it brings me the Schema name, Type, of an entity on the console.
so far I can do it, what I'm having trouble with is bringing all the DisplayName and field size of all the fields of the selected entity.

Follow current code please help me with this question.
Thanks.

function TesteCa() {

    console.log("INICIO MEU LOG");

    var req = new XMLHttpRequest();
    req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='account')/Attributes?$select=SchemaName", 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) {
                debugger;

                var results = JSON.parse(this.response);

                for (var i = 0; i < results.value.length; i++) {

                    console.log("Schema Name: " + results.value[i].SchemaName + ", Type: " + results.value[i]["@odata.type"]);

                    //document.getElementById("Schema Name: " + results.value[i].SchemaName + ", Type: " + results.value[i]["@odata.type"]).innerHTML = results;
                }
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send();


}

he returns me
Schema Name: TerritoryIdName,
Type: # Microsoft.Dynamics.CRM.StringAttributeMetadata

I need to add it
DisplayName
Size

Thanks


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images