function Callcustomaction(actionName, param1Value) {
var result2 = null;
var result = {};
result.Output1 = {};
result.Output2 = {};
var data = {
"Param1Name": param1Value,
"Param2Name": ""
};
var req = new XMLHttpRequest();
var uri = Xrm.Page.context.getClientUrl() + "/api/data/v8.0/";
try {
req.open("POST", encodeURI(uri + actionName), false);
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) {
result2 = JSON.parse(this.response);
} else {
var err = JSON.parse(this.response).error;
alert(err.message);
}
}
};
req.send(JSON.stringify(data));
result.Output1 = result2.Output1;
result.Output2 = result2.Output2;
return result;
} catch (err) {
alert(err.message);
}
return result;
}