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
MrutyunjayMrutyunjay 

Test class issue in lead convert

Hi

 

I have some code like this ,this works fine generally

 

Database.LeadConvert lc = new database.LeadConvert();

lc.setLeadId(leadid); lc.setConvertedStatus(selectstatus);

lc.setDoNotCreateOpportunity(true);

lc.setOverwriteLeadSource(false);

lc.setSendNotificationEmail(false);

Database.LeadConvertResult lcr = Database.convertLead(lc);

system.debug('leadconvert'+lcr.isSuccess());

 

 

But when i write test class for this, leadconvert result always returns false.

Any way to cover this lines of code or  any way to fix it out.

 

sfdccoder1sfdccoder1

Hi Mrutyunjay,

 

add this line to the end of the code:

 

system.debug('errors=' + lcr.getErrors()); 

 

And tell me what you got.