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

Populating fields automatically during lead conversion



I want to autopopulate custom field values while converting lead to account, contact and opportunity.

I tried to map the lead fields, but is is getting mapped for only single object account or contact or opportunity.


Please let me know how i can populate the field values for all the three.



Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 

trigger LeadConvert on Lead (after update) {

  // no bulk processing; will only run from the UI
  if ( == 1) {

    if (Trigger.old[0].isConverted == false &&[0].isConverted == true) {

      // if a new account was created
      if ([0].ConvertedAccountId != null) {

        // update the converted account with some text from the lead
        Account a = [Select a.Id, a.Type_of_Contact__c, a.Region__c,a.Country__c From Account a Where a.Id =[0].ConvertedAccountId];
        a.Type_of_Contact__c =[0].Type_of_Contact__c;
        a.Please_specify_if_other__c =[0].Other__c;
        a.Region__c =[0].Region__c;
        a.Country__c =[0].Country__c;
        update a;


      // if a new contact was created
      if ([0].ConvertedContactId != null) {

        // update the converted contact with some text from the lead
        Contact c = [Select c.Id, c.Type_of_Contact__c, c.Region__c,c.Country__c From Contact c Where c.Id =[0].ConvertedContactId];
        c.Type_of_Contact__c =[0].Type_of_Contact__c;
        c.Please_specify_if_other__c =[0].Other__c;       
        c.Region__c =[0].Region__c;
        c.Country__c =[0].Country__c;       
        update c;

      // if a new opportunity was created
      if ([0].ConvertedOpportunityId != null) {

        // update the converted opportunity with some text from the lead
        Opportunity o = [Select o.Id, o.Opportunity__c,o.Region__c,o.Country__c from Opportunity o Where o.Id =[0].ConvertedOpportunityId];
        o.Opportunity__c =[0].Type_of_Contact__c;
        o.Please_Speci_if_other__c =[0].Other__c;       
        o.Region__c =[0].Region__c;
        o.Country__c =[0].Country__c;       
        update o;