Salesforce Free Developer >

Chapter 6 - Apex DML and Database Methods >

Lead Conversion | Method in Apex Database Class

Lead Conversion | Method in Apex Database Class

Public static void main()


Lead l = [SELECT name FROM lead WHERE name like ’sh%’ LIMIT 1];

Lead l1 = new Lead(lastName=‘’,companyName=’’);

Insert l1;

Database.leadConvert lc = new Database.leadConvert;


System.debug(‘ID of record inserted is: ’;


lc.ownerId=’a027F000001XWU7’; // any user id

Database.leadConvertResult lcr = Database.convertLead(lc);



Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners. But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

Your email address will not be published. Required fields are marked *