title: Lead Conversion in salesforce using apex
body: <p>Hi i am trying to convert Lead into account and contact but this code convert only into contact and also don't deleted from lead please help.
  Thank in advance.</p>
  
  <pre><code>public class ConvertLead {
      public ConvertLead()
      {
          System.debug('convert lead called');
          Lead myLead = [SELECT Id FROM Lead WHERE FirstName = 'John'];
          Database.LeadConvert lc = new Database.LeadConvert();
          lc.setLeadId(myLead.id);
          LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
          lc.setConvertedStatus(convertStatus.MasterLabel);   
          Database.LeadConvertResult lcr = Database.convertLead(lc);
          System.assert(lcr.isSuccess());
          System.debug('converted');
  
      }
  }
  </code></pre>