ApexIntermediatedmlintegrationapex
Explain Database.Methods for convertLead and other specialized DML
Real World Scenario
Integration converts 500 Leads per batch using manual Account Contact Opportunity create instead of Database.convertLead causing duplicate Account matches.
Expected Answer
• Database.convertLead with LeadConvert objects bulkified
• LeadConvert setAccountId for existing Account match path
• Database.LeadConvertResult per lead error collection
• Duplicate rule interaction during convert—test partial convert
• Governor limits on convert same as DML rows
• Prefer convertLead over manual create for standard lead conversion semantics
• Test convert with existing Account match and new Account paths
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Direct answer: Database.convertLead with LeadConvert objects bulkified Also consider: LeadConvert setAccountId for existing Account match path In practice: Database.LeadConvertResult per lead error collection Balance speed of delivery with maintainability.
Architect Perspective
Platform DML methods encode business semantics—manual recreate often misses duplicate matching.