Actions in CRM can reduce manual workloads and give developers a trigger point to lead into custom development. These can be called from Workflows, JavaScript, plugins, and custom Workflows. We can pass the Input parameters to the custom Action and the results can be set as Output parameters. Actions can be called from buttons in CRM using JavaScript. In today’s blog, we’ll show you how this all works and the steps needed. Let’s dive in!


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[0].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.

Setting Output Parameters in Plugins for Custom Actions

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!

Happy CRM’ing!

Avatar for Joe D365

Joe D365

Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.