How to set the output parameter in plug-in code so the javascript caller of the custom action will be able to read it?
Custom action is implemented in a plugin. There is an empty process (action) defined to specify input and output parameters. The plugin is registered at step 40.
Calling a custom action via javascript with ajax call to organization service using a SOAP message, which calls the action using the message 'new_NameOfAction'.
The code executes normally and returns a success response to the javascript caller.
The output parameter is set like this in the plug in code:
localContext.PluginExecutionContext.OutputParameters[Outputs.FieldErrors] = "some field error";
However, upon return to the javascript caller, the field is always null.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<ExecuteResponse xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
<ExecuteResult xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:ResponseName>new_NameOfAction</a:ResponseName>
<a:Results xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType><b:key>FieldErrors</b:key><b:value i:nil="true"/></a:KeyValuePairOfstringanyType>
</a:Results></ExecuteResult></ExecuteResponse></s:Body></s:Envelope>