You need to sign in to do that
Don't have an account?
Sakthi Ganesh R
ConvertLead failed. First exception on row 0; first error: ENTITY_IS_DELETED, entity is deleted: []
I'm Trying to get the code coverage for the following trigger.
Error MessageSystem.DmlException: ConvertLead failed. First exception on row 0; first error: ENTITY_IS_DELETED, entity is deleted: []
Stack TraceClass.Testleadconversiontrigger.Test_LeadConvert: line 28, column 1
Can anyone help me on this?
Thanks in Advance.
Trigger AutoConverter on Lead (after insert,after update,before update) { if(trigger.isafter) { LeadStatus convertStatus = [ select MasterLabel from LeadStatus where IsConverted = true limit 1 ]; List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>(); for (Lead lead: Trigger.new) { if (!lead.isConverted && lead.Is_the_lead_from_CSA_Sign_Up_page__c == 'Yes') { Database.LeadConvert lc = new Database.LeadConvert(); String oppName = lead.Name; lc.setLeadId(lead.Id); //lc.setOpportunityName(oppName); lc.setDoNotCreateOpportunity(true); lc.setConvertedStatus(convertStatus.MasterLabel); leadConverts.add(lc); } } if (!leadConverts.isEmpty()) { List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts); if(trigger.isupdate&&lcr[0].success==true){ /// } } }Here's the test class:
@isTest private class Testleadconversiontrigger { private static id leadid; //{ static{ Lead L1 = new Lead(); L1.firstname = 'f1'; L1.lastname = 'l1'; L1.title = 'manager'; L1.leadsource = 'word of mouth'; L1.company = 'MOD'; L1.Is_the_lead_from_CSA_Sign_Up_page__c='Yes'; Insert L1; leadid=L1.id; } static testMethod void Test_LeadConvert(){ Database.LeadConvert lc = new database.LeadConvert(); lc.setLeadId(leadid); lc.setDoNotCreateOpportunity(true); test.StartTest(); LeadStatus convertStatus = [Select Id, MasterLabel from LeadStatus where IsConverted=true limit 1]; //lc.setOwnerId(testUser1.id); lc.setConvertedStatus(convertStatus.MasterLabel); Database.LeadConvertResult lcr = Database.convertLead(lc); System.assert(lcr.isSuccess()); test.StopTest(); } //} }But i'm getting the follwoing error on line no 28 in test class,
Error MessageSystem.DmlException: ConvertLead failed. First exception on row 0; first error: ENTITY_IS_DELETED, entity is deleted: []
Stack TraceClass.Testleadconversiontrigger.Test_LeadConvert: line 28, column 1
Can anyone help me on this?
Thanks in Advance.