Inogic is a hub of like minded professionals who believe that innovativeness is the key for providing the most optimum solutions in the SME segment.We are committed to putting our time and efforts to Research and Develop on Dynamics CRM so that you can be benefited by the cutting edge methodologies. We endeavor to share some of our work on this blog by introducing Tips, Tricks and products from our labs.
Until CRM 4 there were Workflows that could be used for asynchronous processing of business logic, generally used for setting up automated actions and defining sales process in Dynamics CRM.
Since CRM 2011, the workflows became a category under Processes and there was another category Dialogs introduced. Dialogs provided for execution of Dialog scripts to set up process flows for the Salesforce. These could be used to guide the sales people through the sales process using a question/answer format. The Dialog included execution of automated steps like the workflows.
With CRM 2013, the Processes have been extended to now include Business Process Flow and Actions in addition to the categories from the previous versions. In our earlier blog we have discussed the concept of Business Process Flow (hyperlink to earlier blog). This article will concentrate on Actions.
What are Actions?
Actions are messages that can defined for an entity. Existing examples messages include Create, Update, Set State, Assign etc. With Actions, the CRM platform has enabled the creation of custom actions for entities to extend the XRM platform.
Where to use Actions?
An example of a custom action could be “Approve”. Often times we have to design an approval process for Dynamics CRM. Once the item is approved, certain actions need to be performed. In previous versions it would either be implemented as a Workflow that is manually executed from the Workflows Dialog or it involved added of a custom attribute that when checked would imply the item is approved and then the workflow would capture the update of this field to process any automated actions defined.
How to setup an Action?
Let us take an example of an approval process. When an item is “Approved”, we want to send email notifying the concerned parties of the approval.
Here in this above script RequestName indicates the Unique Name of Action and Parameters contains collection of key value pairs that can be passed to Action. In above script We can use below function using below syntax.
You can register plugin on the Approve message. The input parameters of the Approve message will receive the input parameters as defined in the Approve Action.
The plugin registration tool will start showing this message for the Order entity to register plugin against.
Once the plugin is registered, in the code you can access the input parameters just like you do for other messages as shown below
To get access to the image of the Order record
EntityReference entityRef = localContext.PluginExecutionContext.InputParameters["Target"] as EntityReference;
To read the ApprovedBy input parameter
EntityReference approvedBy = localContext.PluginExecutionContext.InputParameters["ApprovedBy"] as EntityReference;
In the pre-stage, you can throw an InvalidPluginExecution error to abort the Approve operation.
Actions is a powerful tool in the hands of the developer to truly extend the CRM platform for XRM implementations.
Posted by: Inogic
For more information/discussions (documents, sample code snippets, detailed work flow or diagrams)
Please be free to visit the following links or email us:
I've created an Action, tried to trigger it from JS using SOAP call. Its not getting triggered.
I've called it from custom code, it works fine. With SOAP call, the request gets succeeded with response statuscode =200 , but no impact on Action. Could you pls help out?
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics