MS CRM - Actions
We have seen a new category
under Processes called Real Time Workflows as
one of the Top 10 New
features of CRM 2013. In addition to this, we have another exciting
feature for developers called Actions, which is also under Processes.
Actions are messages that can be
defined for an entity. Out-of-the-box CRM provides a set of pre-defined
messages for each entity (like create, update, delete and others), but there
can be cases when you want a custom
action. For example: approve, reject, delegate or any other action that fits
your business needs. Through actions, we can create our own messages for any
entity type. Below are the steps to create a sample action.
Here is an example of
creating an action when an account record is delegated.
1. Go to Settings > Processes >
Click New
Enable Rollback: There may be cases when you have a code which runs out of the scope for CRM and you may not be able to roll back the action. The option of rolling back can be disabled for each action.
Direction: You can set either
the Argument as an input or Output Argument to
an action, by using direction.
Type: Below are the available
types of arguments.
3. Once the Arguments are set, the Steps available to add the logic is similar to the workflows.
When the logic is defined for the action, you just need to activate it. Now this action is available for the developers and they can easily call this action from a custom code whenever it is required.
The main advantage of
actions is to provide the ability to modify the logic easily whenever a business
process is changed. A business user can modify this without the help of a
developer. Although you won’t be able to run the actions without a custom code,
they are helpful when there is frequent change in the process. Actions can be
run by a plugin, a custom workflow, or while doing integration with another
system, a custom client application, or JavaScript.
In addition to the
messages for a specific entity, CRM 2013 provides an option to create a Global
Action. This can be created by selecting the entity name as None
(global), as shown below while creating the action in step 1.
.
This is useful when you have any common actions that need to be performed for multiple entities or globally across the application.
Now you know how to
create actions in Dynamics CRM 2013, which are a powerful and easily manageable
feature.
For more helpful
tips, keep checking back for more blogs covering Dynamics CRM 2013 features,
and check out our events page for upcoming CRM 2013
educational webinars.
Happy CRM’ing!
***************************************************************************
Invoke custom actions from a workflow or dialog
In Microsoft Dynamics CRM, workflows and dialogs have numerous capabilities supporting business scenarios. Calling basic SDK actions for a record, such as create, update, and delete, from within a workflow or a dialog solves quite a few business scenarios. However, if you couple the capabilities of the workflows and dialogs with the power of the custom actions invoked directly from within a workflow or a dialog, you add a whole new range of business scenarios to your application without needing to write code.
Let’s look at the scenario in which a custom action is invoked from a workflow and a dialog. We’ll invoke a custom action to request the manager’s approval when a discount for a particular opportunity exceeds 20%.
- Go to Settings > Processes.
- On the Nav bar, choose New. Give the process a name and choose the Action category.
To request an approval for the discount, we’re using a custom action called Approval Process. We added an input parameter, SpecialNotes, and aSend email step to create a new message and send a request for the manager’s approval, as shown here.
To configure the email message, choose Set Properties. When the form opens, use the Form Assistant to add special notes and other information to the email, as highlighted on the screenshot. To add the special notes, place the cursor where you want them to appear in the message, and then, in the Form Assistant, under Look for, choose Arguments in the first drop-down list and choose SpecialNotes in the second drop-down list, and then choose OK.
Before you can invoke the action from a workflow or dialog, you have to activate it. After you have activated the action, you can view its properties by choosing View properties.
Invoke a custom action from a workflow
- Go to Settings > Processes.
- On the Nav bar, choose New. Give the process a name and choose the Workflow category.
We created a workflow that invokes the Approval Process custom action whenever the manager’s approval for a discount over 20% for an opportunity is required.
You can set the action’s input properties by choosing Set Properties. We added a name of the account related to the opportunity in the special notes. In the Form Assistant, under Look for, choose Account in the first drop-down list, choose Account Name in the second drop-down list, and then choose OK. The Target property is required and it is populated by the system. The {Opportunity(Opportunity)} in the Target property is the same opportunity that the calling workflow is running on. Alternatively, you can choose a specific opportunity for the target property by using lookup.
Invoke a custom action from a dialog
- Go to Settings > Processes.
- On the Nav bar, choose New. Give the process a name and choose the Dialog category.
You can implement a scenario that’s similar to calling the Approval Process from a dialog as shown in the following illustration.
Set up input parameters, as shown here.
*******************************************************************************************************************