标签:ati loading 变化 doc 编码 关注 count gic eva
var clientURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest() req.open("GET", encodeURI(clientURL + "/api/data/v8.0/EntityDefinitions?$filter=SchemaName eq ‘ly_Test‘"), true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4) { req.onreadystatechange = null; if (this.status == 200) { var responseJSON = JSON.parse(this.responseText); Xrm.Utility.alertDialog("查询到的元数据ID是" + responseJSON.value[0]["MetadataId"] + ",实体复数显示名称是:" + responseJSON.value[0].DisplayCollectionName.LocalizedLabels[0].Label + ",主属性是:" + responseJSON.value[0].PrimaryNameAttribute); } else { var error = JSON.parse(this.responseText).error; Xrm.Utility.alertDialog("查询罗勇测试实体元数据出错." + error.message); } } }; req.send();
var clientURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest() req.open("GET", encodeURI(clientURL + "/api/data/v8.0/EntityDefinitions?$select=DisplayCollectionName,PrimaryNameAttribute,SchemaName&$filter=IsCustomizable/Value eq true&$count=true"), true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4) { req.onreadystatechange = null; if (this.status == 200) { var responseJSON = JSON.parse(this.responseText); Xrm.Utility.alertDialog("共有" + responseJSON["@odata.count"] + "个实体可以定制,第一个实体的元数据ID是" + responseJSON.value[0]["MetadataId"] + ",实体复数显示名称是:" + responseJSON.value[0].DisplayCollectionName.LocalizedLabels[0].Label + ",架构名称是:" + responseJSON.value[0].SchemaName + ",主属性是:" + responseJSON.value[0].PrimaryNameAttribute); } else { var error = JSON.parse(this.responseText).error; Xrm.Utility.alertDialog("查询罗勇测试实体元数据出错." + error.message); } } }; req.send();
var clientURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest() req.open("GET", encodeURI(clientURL + "/api/data/v8.0/EntityDefinitions(e373eab4-9ca4-e511-80cc-000d3a80ce7f)?$select=SchemaName&$expand=Attributes($select=SchemaName;$filter=AttributeType eq Microsoft.Dynamics.CRM.AttributeTypeCode‘String‘ and IsCustomizable/Value eq true and IsCustomAttribute eq true and IsLogical eq false)"), true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4) { req.onreadystatechange = null; if (this.status == 200) { var stringFields = ""; var responseJSON = JSON.parse(this.responseText); if (responseJSON.Attributes != null && responseJSON.Attributes.length >= 1) { for (var i = 0; i < responseJSON.Attributes.length; i++) { stringFields += responseJSON.Attributes[i].SchemaName + ";"; } } if (stringFields != "") { Xrm.Utility.alertDialog("这个实体的文本字段有" + stringFields.substring(0, stringFields.length - 1)); } } else { var error = JSON.parse(this.responseText).error; Xrm.Utility.alertDialog("查询罗勇测试实体元数据出错." + error.message); } } }; req.send();
Dynamics CRM 2015/2016新特性之二十七:使用Web API查询元数据
标签:ati loading 变化 doc 编码 关注 count gic eva
原文地址:https://www.cnblogs.com/luoyong0201/p/Dynamics_365_Web_API_Query_Metadata.html