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
Kiran  KurellaKiran Kurella 

Lead Conversion via APEX code - ConvertedDate

Hi

We are getting the following message: "This lead was converted on {0}", when converting a Lead via APEX code using "ConvertLead" method.

Observation: We noticed the standard field "ConvertedDate" was null after we converted the Lead through code. When we converted the Lead by using SFDC standard Convert button, the "ConvertedDate" field is filling properly with today's date.

Did we miss anything or is there a bug in the API?

Thanks in Advance

-----------------------------------------------------------------------------------------------------

Here is the code we are using for the conversion:

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

            LC.setAccountId(MatchingAccounts[0].Id);
            LC.setLeadId(LeadNew[Ld].Id);             
            
            LC.setDoNotCreateOpportunity(true);
            LC.setConvertedStatus('Converted'); 
            
            Database.LeadConvertResult LCR = Database.convertLead(LC);            

 

 

canonwcanonw
Is that Lead.IsConverted set to true?  Once the Lead.IsConverted is set to true, you cannot reuse it for another lead conversion implicitly. 
Kiran  KurellaKiran Kurella

Lead.IsConverted is false. We are converting a brand new Lead, after the conversion the Lead.IsConverted is set to True by the API but it is not setting the field ConvertedDate.

Thanks