【发布时间】:2019-05-24 22:07:01
【问题描述】:
无法确定如何使用新的 retrieveMultipleRecords(客户端 API 参考)从以下 fetchXml 获取结果:
var request = "<fetch output-format='xml-platform' distinct='true' version='1.0' mapping='logical'>" +
"<entity name='msdyn_incidenttype'>" +
"<attribute name='msdyn_name'/>" +
"<attribute name='createdon'/>" +
"<attribute name='msdyn_estimatedduration'/>" +
"<attribute name='msdyn_incidenttypeid'/>" +
"<order attribute='msdyn_name' descending='false'/>" +
"<link-entity name='product' link-type='inner' alias='ag' from='productid' to='aka_productfamilyid'>" +
"<link-entity name='msdyn_customerasset' link-type='inner' alias='ah' from='msdyn_product' to='productid'>" +
"<filter type='and'>" +
"<condition attribute='msdyn_customerassetid' operator='eq' uiname='' uitype='msdyn_customerasset' value='${custAssetId}'/>" +
"</filter>" +
"</link-entity>" +
"</link-entity>" +
"</entity>" +
"</fetch>";
我将上面的 fetchXml 与新的客户端 api 引用一起使用,如下所示:
var results = Xrm.WebApi.retrieveMultipleRecords("msdyn_incidenttype",request).then(
function success(result) {
for (var i = 0; i < result.entities.length; i++) {
console.log(result.entities[i]);
}
console.log("Next page link: " + result.nextLink);
// perform additional operations on retrieved records
},
function (error) {
console.log(error.message);
// handle error conditions
}
我阅读的文档 (https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords) 指出第二个参数是选项,如果是 fetchXml(我正在使用),那么在此处指定它。但是我在控制台中收到以下错误:
HTTP400: BAD REQUEST - 请求无法由 服务器由于语法无效。 (XHR)获取 - https://dev.crm.dynamics.com/api/data/v9.0/msdyn_incidenttypes?fetch 输出格式='xml-platform' distinct='true' 版本='1.0' 映射='逻辑'>实体名称='msdyn_incidenttype'>属性 name='msdyn_name'/>属性名='createdon'/>属性 name='msdyn_estimatedduration'/>属性 名称='msdyn_incidenttypeid'/>订单属性='msdyn_name' 降序='false'/>链接实体名称='产品'链接类型='内部' 别名='ag' from='productid' to='aka_productfamilyid'>link-entity 名称='msdyn_customerasset' 链接类型='inner' 别名='ah' from='msdyn_product' to='productid'>过滤器类型='and'>条件 属性='msdyn_customerassetid' 运算符='eq' uiname='' uitype='msdyn_customerasset' value='${custAssetId}'/>/filter>/link-entity>/link-entity>/entity>/fetch>
我错过了什么吗?
【问题讨论】:
标签: javascript dynamics-crm dynamics-crm-online fetchxml dynamics-crm-webapi