In this webinar, our experts showcase a variety of demo use cases of how different components of the...
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.
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!
When I try to have 2 Output EntityReference I always got an error.
When I try to have 1 Output EntityReference, and I do a webapi call in the response I receive a key contactid, value the guid of my entity reference instead of "OutputParameter": {my entityreference object}
Any idea how to get 2 Output EntityReference? I tried with same type or different types I always have an error when I execute the action via the webapi.
If you're having troubles calling/parsing custom actions, the CrmRestBuilder is a very helpful tool to try: https://github.com/jlattimer/CRMRESTBuilder/releases
What object do I set in my plugin for a picklist on the form ?
Pick-list attributes are represented as OptionSetValue types.
Hey I want to retrieve value of lookup from one entity to another. On Pre-operation
Can I get the value of lookup field after saving record ? I m getting value of string, whole number problem with only lookup.