Monday, 12 May 2014

CRM 2013 Let Me Introduce a Nice New Feature : Custom Actions

CRM 2013 is not merely about UI Refreshment. It’s also coming with new great features.
In this post, I would like to you know about one of the great features : CUSTOM ACTIONS.
 
Overview
 
Action in CRM 2013 is definitely a process that allows a non developer user to create it and add some logic same as well as Workflow, but Action is only be able to be called or triggered by a custom code, it can be client or server code, meaning that Javascript and C# can call Action.
So, we can combine logic from developer and non-developer to implement a business logic using Action. Actions can be defined for an entity, but Actions also can support for Global entity, meaning that not merely tied to a specific entity. Actions can be used to several CRM messages, such as CRUD, Assign, Set State, etc. It enables solution architect to extend and explore the xRM platform.
Here are some posts that can help you to understand Custom Action and how to setup this.
 
Specification
 
1. Action can be used to Global entity and a specific entity.
2. Custom Action can help you to extend xRM Platform
3. Custom Action can be triggered using Javascript or C#, or another language using CRM API, such as SOAP or REST methods.
4. Custom Action need to be activated first and can be edited later
5. Custom Action can be used to set static and dynamic field value
6. The most interesting thing is Custom Action can be used as Custom Message or Event Handle and can be registered by using Plugin Registration Tool! It means that you can extend xRM and do anything using this new custom message.
Such as : onSubmittedApproval Message, onCalculatedField, or whatever you want.
7. Do you know that you also can use Action to receive some input, do validation, and then manipulate the output? For example, for Approval Process needs validation and formula calculation.
 
Why We Should Use Action and When?
 
You can use Action anywhere and anytime. Wherever and whenever you need it since both client and server code supports this calling.
What scenario or business idea you can achieve using custom Action?
 
1. Say partial good-bye to Custom Entity that so-called as Configuration Entity

Last time using CRM 4 or CRM 2011, I remember I always use Configuration Entity or Configurable Parameter to store some information that can be called by third party application, such as Console or Web App or event Web Part from SharePoint that we can develop. Or for outside application, I can use web.config or app.config with encryption, etc.
For example : to store server URL, username and password, additional settings, such as : maximum permitted credit card account for each Customer, maximum Membership card for each Member, minimum monthly fee for rental as commitment, enable for approval checkin (yes/no) then if Yes, do something, if No then stops it, due date for submitting an activity for each month, etc. There are real condition that we often face and we cannot do hard-coding, right.
Let’s say after an Order created, then pass the information to Navision (integration to Navision), then we have to detect in the Plugin onCreate, pass information to which Navision Server? Then what we do is by reading a custom entity so-called Configuration. It’s fine to use this conventional way, but don’t forget to make validation as well, cannot have more than one record to store Navision Server URL, don’t want to make system being confused.
Now, you can achieve this.
 
2. To show a Custom Error Messages
 
Many times, we have plugin and we should show a error messages, for example : “Please input ‘City’ value! or ‘City’ cannot be blank!
Then, what we do often is do hard-code in the Plugin or again, using the first method, reading Configuration entity that store some error messages.
Imagine, you have many plugins and you have to reading that entity and imagine that you have to change your words later. For example, now the message is “Please input ‘City’ value!, then later your customer says I don’t want to use that statement, I want a more polite word : “Sir/Madam, please fill the ‘City’ value. The developers statement for some errors can be different from what customer want, and what happened if you hard-code it.
 
3. Custom action as Custom Message
 
Several times, I was being forced to trigger a plugin using JavaScript by creating a dummy record to fix a complex business flow requiring a complex code. Custom action can be used as custom action and you can register your action same as well you register your Plugin Message.
 
4. Custom action to solve complex Business Requirement
 
I often have requirement that should be easier if I code it using server code, for example : Calculation, Approval, Third Party Integration, such as SMS, Product Configuration, the want they I can do is I have to write a custom code of workflow activity, a custom web service, a batch scheduler job, or trigger a plugin. Using action, based on point number #3, since Custom action can be used as custom message, then we can use Custom Action to implement our complex logic and it is easy to call custom action. To know more about this, I promise I will give you example on my next posts.
 
5. Custom action is a single point of integration.
 
Can you imagine if you are trying to do integration for other system, both inbound or outbound that you should write many custom code.
For example, if you want to pass information from your website to CRM, then you can do either you write code in your website code call CRM API, or you use web service, let’s say you are trying to have a business logic for creating a lead from several websites and POS System, and as well you can create directly using CRM Import Wizard. How many point of gate you have?
 
Imagine, you have 3 websites (one for case support and enquiry, one is forum discussion, one is public official website), 2 Desktop Apps (one is for Agent at a branch and one is you put at kiosk), and 1 Console Job Application (for retrieving data every day collecting Social Media interaction), then you have at least 6 gates from your another application that customer wants you to let them generating lead or contact from all of six apps. Then what you is you can implement your code of all of your 6 apps, imagine you have 6 apps but all of them having one purpose and having a lot of Input Arguments that should be same, then you have to do 6 times, implement your code, or smart way is you can use a web service to be called by them. Instead using web service, you can using Action (refer to point number #2, you can use Custom Action as Custom Message).
 
Let’s say other example, you have a Quotation that you should let the salesperson to input : Total Amount, Tenure, Interest Rate, and Discount Rate to calculate Net Monthly Rental. For CRM apps, every time you create quotation or every changes of those 4 fields, you have to re-calculate again, so meaning that you have to create a plugin onCreate and onUpdate then you have to implement the code for two of them.

Then, your customer also have another web apps, mobile apps, and a desktop apps to calculate Net Monthly Rental using same Formula and Same Inputs as well to get one Output, that is Net Monthly Rental. Imagine, you have to write code and put into all of them, including two plugins and 3 apps, yes you can copy paste, but later let’s say your formula has been changed, now your monthly rental is not only about Total Amount plus interest divide by tenure, but your salesperson also can quote a committed amount, for example additional installment 1% of Total Amount if the Monthly Rental is less than USD 10,000, etc.
 
Then, you have to re-develop again your logic in every part you put in, 2 plugins and 3 apps at least. In this scenario, actually you can using custom action to put your calculation logic inside then all of your apps can call this action, including using Javascript or Server Code. You just input arguments and get the output. The arguments will be the input and be used for calculation inside the custom action logic to get the output as a result.
Okay, I think better if we got an example, please refer to my next posts.
 
Note
 
During import a solution that containing a Custom Action, you might be facing an error : Workflow with Id {Guid} does not exist.

To avoid that error, please refer to use this blog link to guide you :
 
Hope it helps!
 

1 comment:

  1. view the best for upcoming crm software for develop the basics of employee system I have follow the good ones you can follow us at :-with CRM tool you can implement all such with ease. The online lead management which is currently running in the market has wide range of features and benefits on offer that makes Best CRM Software preferable enough for all.

    ReplyDelete

Aileen Gusni

Aileen Gusni