Output Parameters can be set via a Plugin. We call an Action from a Workflow. Additionally, the Input parameters can be set and accessed from the context in the plugin.
Now let’s see how to set the Output parameters from the plugin using the steps below:
1. First, access the Input parameters in the plugin of the custom Action.
EntityReference recordEntRef = (EntityReference)context.InputParameters[“Record”];
2. Set the Input parameter “Record” with the data type of Entity Reference.
3. Set the Output parameters in the plugin for the Action.
context.OutputParameters[“OutputParameter”] = returnRecords.Entities.GetAttributeValue<EntityReference>(“assigneduserid”).Name.ToString();
“OutputParameter” is the output parameter data type as Entity Reference.
If the Output parameter is set in the plugin for the custom Action, then it should be registered on Post-Operation. If the step is registered as Pre-Validation or as Pre-Operation, then the Output parameters will always be null even if we try to set them in the plugin.
If the Output parameter gets back a response, it can be processed for further use.
var actionResponse = (OrganizationResponse) service.Execute( actionrequest );
if (actionResponse.Results.Contains( “OutputParameter” ) )
return actionResponse.Results[ “OutputParameter” ];
Want to get handy CRM tips and tricks like this one delivered directly to your inbox? Subscribe to our blog today!