Tuesday, May 27, 2014

Control Lead Qualification process in CRM 2013 - Refresh Page

Scenario :
You may not want to create account record or create opportunity record or both. I do not want to replicate the same content here . This article is very much informative but its lacking of giving comprehensive process to the end user. i.e : Once you have hooked the plugin up with the qualify lead message, the subsequent process is hindered. The page freezes and user does not realize the lead is qualified. This may end up with multiple clicks and multiple error messages, as the lead is already closed.

Solution :
1.             Follow up the article and bind the plugin for the qualify lead message.
2.             Write a javascript to show a notification to the user and reload the current record. My script is as follows :

function ShowQualifiedNotification(logicalNameOfEntitiy, recordId){
         Xrm.Utility.alertDialog("The selected lead is qualified",function(){Xrm.Utility.openEntityForm(logicalNameOfEntitiy, recordId)})
}

3.             Upload the above javascript as webresource.
4.             Install Ribbon work bench from here.
5.             On the form section, right click on Qualify, and click on Customize Command as below.















6.             Add a new step to the existing two commands, with a new javascript function you have written.
















7.             Add CRM type parameter as above.
         8.     Publish the solution

Now once you clicked the qualify lead, you will get a notification and the record refreshes.