Hello,
I added output parameter (called 'resultString');
In my plugin I added this line: context.OutputParameters["resultString" = "hello";
In my devtools I can see the output when I call the action:

and now I want to show an alert to the user containing this string but I guess I am missing something. This is my javascript code, line 16 is where I use the output
function createordersbutton() {
debugger;
var entityId = Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() "/api/data/v9.1/opportunities(" entityId ")/Microsoft.Dynamics.CRM.zst_OpportunityCreateOrdersandEntitlements", 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) {
Xrm.Utility.alertDialog(this.resultString);
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
}Anh help would be much appreciated.