I created a javascript button that will convert the current lead to a contact based on conditions that I've sent. It works as expected. The problem I have is the custom fields from the lead are not mapping to the contact after conversion.

The mapping enter image description here

The apex code the converts the lead

    // query a single contact that has the same first/lastName and email as the lead,
    // and marketo sync is true.
    // the contact will be the one that was last modified at the closest date to 
    // today.                
    Contact c = [SELECT Id, AccountId, OwnerId
                 FROM Contact 
                 WHERE (Email               = :l.Email
                        AND FirstName       = :l.FirstName 
                        AND LastName        = :l.LastName
                        AND Marketo_Sync__c = true
                        AND Owner.Profile.Name IN :profileNames)
                 ORDER BY LastModifiedDate DESC
                 LIMIT 1

    // if matched contact found, update the contact owner to be
    // the same as the lead owner
    c.OwnerId = l.OwnerId;
    update c;

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

    LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted = true LIMIT 1];


    // throw an error if the contact soql fails
}  catch (QueryException e) {

Database.LeadConvertResult[] lcrList = Database.convertLead(leadsToConvert, false);

1 Answer 1


This is expected, as noted in Considerations for Converting Leads:

When updating existing accounts or contacts during lead conversion, the values of mapped lead fields do not overwrite the values of the mapped account and contact fields.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .