have a scenario where I need to trigger a plugin on a ribbon button click (SYNCH), I have setup the commands and buttons, I have created a custom action,that will be registered in the plugin reg tool to wire up the event. I have tested the ribbon button that just does a simple hello world, so I am sure that the basics are dine and set. My issue lies when I try to call the function that does a SOAP invocation. Here is my code below.
function CallAction() {
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/products/Microsoft.Dynamics.CRM.new_ProductPr", 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) {
//Success - No Return Data - Do Something
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
}
}
*This post is locked for comments