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

Using XMLHttpRequest to update entity, but return status is 400 when enable plugin debugging(start profiling)

$
0
0
  1. I have an entity and there is a web resource inside, when i click the button in this web resource and it will trigger a javascript script to update this entity.
  2. And a plugin,  this plugin will be triggered when specified attribute is changed in the entity.

But when I want to start profiling to debug this plugin using Plugin Registration Tool, this js script update will hit an unexpected return value, this.status is 400. However when I disable this plugin debugging, return value of this js update is 204, it is correct.

I don't understand why this problem is happening, anybody know why?

The following is a part of script:

var req = new XMLHttpRequest();
req.open("PATCH", window.parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.0/" + entityName + "s(" + entityId + ")", false);
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.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
window.parent.Xrm.Utility.openEntityForm(entityName, entityId);
}
else {
alert("System Exception!");
}
}
};
req.send(JSON.stringify(entity));


Viewing all articles
Browse latest Browse all 55831

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>