
Hi, I am trying to invoke action through javascript, but I keep getting this error, it looks like my input parameter doesn't get the parameter value from javascript, not what else I have missed,
function executeAction(){
debugger;
var parameters ={
"ApplicationRef": "8B446743-C6C4-E711-A81C-005056B5FEFA",
"Amount": "590",
"Authcode": "AuthCode5"
};
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/recoserv_ACT101_Payment_MarkAsPaid", true);
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 === 200) {
var results = JSON.parse(this.response);
Xrm.Utility.alertDialog(results.message);
alert("successful");
} else {
var error = JSON.parse(this.response).error;
Xrm.Utility.alertDialog(error.message);
}
}
};
req.send(JSON.stringify(parameters));
//req.send();
}
*This post is locked for comments
I have the same question (0)Maybe try calling stringify and setting a variable before the send. Then pass the variable instead.
Not sure it would make much difference but worth a try.
Good luck!