POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

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!

tips-and-tricks

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 JoeCRM

JoeCRM

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