Custom “Qualify Lead” button on Dynamics 365 Form {CRM tips from the vault}

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com

CRM tips from the vault – A series which I have started on request of my blog readers who are quite new to CRM. My blog focus on niche topics which mostly require a prior in-depth understanding of Dynamics 365. However in this series I will mostly cover the topics which are quite simple, used in almost every project implementations and more importantly have withstood the test of time.

Here is my Tip 1 – Custom “Qualify Lead” button on Dynamics 365 form.

First of all, why is a Custom “Qualify Lead” button required? After all we have the wonderful Out of the box Qualify Lead button which converts a lead to opportunity. But sometimes it doesn’t work because your business need more

Right now this is the default behavior when you click on Qualify lead Button.

image

You get an option to Qualify the lead with an existing account and contact or you can go ahead and make them blank to create a new Account and Contact.

If you click Continue here, the lead shall be converted to opportunity.

Well, that’s fine. But what if you wanted to take control of this lead Qualify functionality? What if you want to open a custom HTML webresource pop-up with additional information to display to the end-user.

In situations like this, we shall need to use a custom Qualify button and hide the OOB one. In this blog, we are only going to concentrate for Dynamics 365 forms.

To modify the Lead ribbon, I will use the wonderful ribbon workbench editor. A time tested classic by Scott Durow. You can download the ribbon wokbench from here.

Once you have downloaded the ribbon workbench, install it and then open up your lead entity in ribbon workbench editor.

Find out the ribbon element with Id = “Mscrm.Form.lead.ConvertLeadQuick”

image

image

The next thing I usually find developer’s doing is hide this button and then come up with completely new custom Qualify button. However the issue with that is you need to re-define all your enable rules and display rules. Understand Qualify button should show up only depending on certain conditions. If you remove the enable and display rules, you need to redefine these conditions on your custom button.

If your goal is to just to override the Qualify button click, we won’t create a new button. Rather we will just go ahead and override the click event handler. Let’s try to do this here.

Right click on the button and click on Customize Command.

image

Then under Commands section select the Command and modify Custom JavaScript Action.

image

As you can see there is Library and Function name. Right now it is pointing to system library and function. All you need to do is create a custom JavaScript and put your own handler.

As you can see from the below screenshot, I have used a custom library and Javascript function on Qualify Lead click. Also make sure to pass PrimaryControl as your function parameter. This will be your form context in case you need to access your form fields within your handler.

Similarly if you want to add a custom enable rule, you can do the same by adding one more enable rule to the list of enable rules already in place. If your business requirement need, you can even remove a OOB enable rule.

Make sure you publish your changes before you leave the ribbon workbench editor.

Hope this helps!

Debajit Dutta

(Microsoft MVP)

Leave a Reply