So you have the Leads related to Accounts based on the match between the Lead’s email address domain and the Account’s website domain. If you don’t, check out this article on how to get the free app to automate this for you. Now your users want to convert Leads right from the Account page and of course, they want to convert more than one at a time!
We have added a new feature to the Relate Leads to Accounts free AppExchange package that will allow you to accomplish this. Version 1.2 of the Relate Leads to Accounts contains these new components:
- Custom Convert (Custom List Button on Lead Object) – this button is used on the Lead related list on the Account page.
- CustomConvertLeadPage (VisualForce Page) – this page is called by the Custom Convert button when it is clicked and has an action that is called when the page loads. It also displays any error messages received from validation rules or duplicate rules.
- CustomConvertLeadController (Apex Class) – this class is invoked by the Custom Convert button via the VisualForce page action. The apex class has the method that will take all the selected leads and call the DML convert action for all of them and sends a failure message to the VisualForce page if an error occurs.
- CustomConvertLeadController_Test (Apex Class) – this is the test class for the CustomConvertLeadController class.
How to Configure the App:
- Install the free app from the AppExchange and make sure to install for all of the profiles that will be using this.
- Go to Setup | Object Manager | Account | Page Layouts
- Select the page layout you would like to add the custom button to and scroll down to the Leads related list. Click the wrench icon.
- Click the + sign in the Buttons section
- Add the Custom Convert button the selected buttons section and click OK
- Save your page layout.
That’s it, now you are ready to start testing!
How It Works
- Hover over the Leads related list on the Account page.
- Check the boxes next to the Leads you want to convert.
- Click Custom Convert. You will now see your Leads in the Contacts related list on the Account.
If an error occurs with one of the Leads during the conversion process, you will receive a message that looks like this. In this example, there was a validation rule that required the Contact to have a zip code that matched the Account. The error message contains a link so the user can easily navigate back to the Account page.