Hi, I am trying to invoke an action through javascript, but I keep getting this error message, "Request message has unresolved parameters", actually, I am trying to test a empty without parameter, something wrong with the JS code?
function executeAddPayment(){
debugger;
var organizationUrl = Xrm.Page.context.getClientUrl();
var id = Xrm.Page.data.entity.getId().replace('{', '').replace('}', '');
var query = "invoices("+id+")/Microsoft.Dynamics.CRM.testpayment";
Alert.show("This will is partial payment", "Please make sure the balance is correct.",
[
new Alert.Button("Check", function (){executeUserAction(organizationUrl, query)}, true, true),
new Alert.Button("Not now")
], "QUESTION", 500, 200);
}
function executeUserAction(organizationUrl, query){
debugger;
var req = new XMLHttpRequest();
req.open("POST", organizationUrl + "/api/data/v8.0/" + query, true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.onreadystatechange = function () {
if (this.readyState == 4) {
req.onreadystatechange = null;
if (this.status == 200) {
var results = JSON.parse(this.response);
if (results.Status==true) {
Alert.hide();
Xrm.Page.data.refresh(false);
}
} else {
Alert.hide();
Xrm.Page.data.refresh(false);
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
req.send();
}






