Having trouble figuring how to get results from the following fetchXml using the new retrieveMultipleRecords (Client API reference):
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>";
I use the above fetchXml with the new client api reference as follows:
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
}
The document I read (https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords) states that the second parameter are options and if is fetchXml (as I am using) then to specify it there. However Im receiving the following errors in console:
HTTP400: BAD REQUEST - The request could not be processed by the server due to invalid syntax. (XHR)GET - https://dev.crm.dynamics.com/api/data/v9.0/msdyn_incidenttypes?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>
Am I missing something here?