RE: how to return a value from plugin to action
Hi Sahara,
You can set the Output parameters in the plugin for the Action using the below code,
context.OutputParameters["OutputParameterName"] = OutputParameterValue
If the result of executed action is fine (i.e. success.ok == true) then you can read your response (or output parameter value) via success.json() as it will parse your response.
Please refer below code for the same,
//Exceute Action
Xrm.WebApi.online.execute(customActionReq).then(
//Perform on success
(success) => {
success.json().then(function(Response){
// In the Response.OutputParameterName you will get your out put value
});
},
//Perform on error
(error) => {
console.log("Error");
}
);
Hope this helps!