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;

lc.setLeadId(l.id);

System.debug(‘ID of record inserted is: ’+l.id);

lc.convertedStatus=’closed-converted’;

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

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

}

Our Recent Blog

Share This Post