function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
이상희이상희 

Approval Process when click convert button

Hi,
My project needs to create process that approve converting lead.

logics i want to construct are this,
1. In lead, When user click convert button, send the approval email to manager.(Until the manager approve, lead must not be converted)
2. If the Manager presses the approval button in the email, lead will be converted to account, contact and opportunity.
(+ By any chance, Can i restrict to create opportunity and Apply same logic?)

how to construct this logic in salesforce?
Danish HodaDanish Hoda
Hi there,
For this, you need to create a custom button named - Convert Lead, standard button won't be able to fire your business requirement.
Follow below steps to achieve this- 
1. Create a button to call a JS or VF page.
2. The controller class of the JS or VF page will fire Approval process through Apex using DMLOptions
3. Create a checkbox field on Lead - "Is Approved for Conversion?" default to False
3. Once the manager approves, update Is Approved for Conversion? field to True using a WF rule to fire in the final approval step in the Approval process.
4. Create a trigger on Lead to check if "Is Approved for Conversion?" is changed to covert the lead using Database.convertLead() method. 
You can also restrict creating an Opportunity using this apex method.
Suraj Tripathi 47Suraj Tripathi 47
Hi,
Greetings!

You can implement this by the flow.
1. Create an action button (Convert Lead) that calls a flow.
2. Create a flow that sends your record for the approval process.
for refer- https://automationchampion.com/2020/11/20/auto-submit-record-into-approval-process-with-flow/

If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi
Baya AdamBaya Adam
Information Transformation Service provides  web scraping Services that provides high-quality structured data to improve business outcomes and enable intelligent decision making,their Web scraping service allows you to scrape data from any websites and transfer web pages into an easy-to-use format such as Excel, CSV, JSON and many others.