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

Test class for the following lead to account conversion trigger

Hi , can someone provide me with the test class for the following trigger. I have never written any test class before this. so please help me out trigger leadAutoConvert on Lead (after insert) { Database.LeadConvert[] conversions = new Database.LeadConvert[0]; LeadStatus status = [SELECT Id,MasterLabel FROM LeadStatus WHERE IsConverted = TRUE LIMIT 1]; for(Lead { Database.LeadConvert convert = new Database.LeadConvert(); convert.setLeadId(record.Id); convert.setDoNotCreateOpportunity(true); convert.setConvertedStatus(status.MasterLabel); conversions.add(convert); } Database.LeadConvertResult[] results = Database.convertLead(conversions,false); for( Integer i = 0; i < results.Size(); i ++ ) { System.debug('lead Conversion Status leadsToConvert['+i+']'+ results[i].isSuccess()); } }