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
Sunil Kumar 545Sunil Kumar 545 

hi,lead conversion using apex class

passing parameter method (first name,lastname,eamil)
check query with lead .eamil is there or not,
if lead exit means it converted to (con/acc),
if does not exit means(contact or account)
using apex class..
SandhyaSandhya (Salesforce Developers) 

Below is the sample code you can use.
Lead myLead = new Lead(LastName = 'Foo', Company='Foo Bar');
insert myLead;    
Database.LeadConvert lc = new database.LeadConvert();
lc.ConvertedStatus = 'Closed - Converted';
Database.LeadConvertResult lcr = Database.convertLead(lc);                

Refer below links for more information.
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sunil Kumar 545Sunil Kumar 545
check whether email is there or not in lead object ...if lead exist means convert to contact and account 
if it does not exist means it sholud be contact using apex class ...send code in only apex class..