Tag: Salesforce Trigger

How to Automatically Convert Leads in Apex

How To Automatically Convert Leads In Apex

In the blog post “What’s the difference between a Lead and Opportunity?” I spent a bit of time covering how leads are converted into accounts, contacts, and opportunities.

Basically, a lead is converted when the sales person thinks that there’s actually an opportunity to sell them something. In a lot of cases, it might make sense of for leads to be automatically converted after a field is set to a certain value. For example, a lot of companies might want to automatically convert a Lead as soon as the Sales Rep has completed ANUM or BANT.

To convert a Lead into an Account, Contact and an Opportuninity we need to make use of the Database.convertLead method.