+ Start a Discussion
Marcel VreulsMarcel Vreuls 

Convert Lead Database.LeadConvertResult


Currently i am running into an issue while converting Leads to Accounts. The process runs fine as is. I have a requirement of changing a value on lead as the conversion is finished. I have looked at the Account After Update trigger and Lead after update trigger. Both are being called and executed on the LeadConvert process from salesforce. What i am trying to do is fetching the leadrecord based on the ConvertedAccountId on Lead it does not work anymore. Apperantly the field ConvertedAccountId on Lead is not being filled yet on execution of the triggers. I think the commit to the database is done later.

The execate situation. Based on the lead source we execute the LeadConvert ourselves or call a external URL (Olbico/D&B) with parameters which executes the leadConvert. In the last option i do not get a LeadConvertResult back. That is why i though i will have a look at the AfterUpdate triggers on Account and Lead but the moment they are executed the Convert Commit is not done yet. So no AccountId on lead.

Any suggestions, idea, concepts how to tackle this issue.

I have thought about mapping the Lead.Id to an Account Custom Field, through the default Fieldmapping. But this is not working as well because i cannot map the ID field in the mapping.

Best regards, Marcel

You can create one text field on lead object for storing Lead Id, using workflow you can populate lead Id in this field. then you can map this custom field of lead with Account custom field using field mapping
You can also use isConverted field of lead, which specify whether lead is converted or not
Marcel VreulsMarcel Vreuls
THe IdConverted field is set to false on that moment. I expect/think dat it will be set after the whole convert transaction closes. So after the triggers.
Marcel VreulsMarcel Vreuls
I have created a formula field to fetch the ID, but cannot map the formula field to another field on account. I will give the textfield a try. Perhaps that works..