Database.convertLead() will create an account, a contact and optionally an opportunity.
I ran the conversion for a lead using the following code.
Lead myLead = [SELECT ID,Status FROM Lead WHERE Id = '00Q9000000nuxhO']; Database.LeadConvert lc = new Database.LeadConvert(); Leadstatus convertStatus = [Select Id, MasterLabel from LeadStatus where IsConverted=true limit 1]; lc.setConvertedStatus(convertStatus.MasterLabel); lc.setLeadId(myLead.id); Database.convertLead(lc); It created an Account, an Opportunity and a Contact.
So ideally it should have been a 3 DML statements right ? But in the log it shows only 1 DML statement.
Can anyone explain the rationale behind this ?
Limits.getDmlStatements()after theconvertLeadcall just to make it more explicit?Database.convertLead(...)runsinsert List<sObject>maybe, the only reasonable explanation that I could imagine