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
Soo Kim 16Soo Kim 16 

Lead "Standard" Field Map to Contact "Custom" field


Hi,
I have a Standard Lead Field in SFDC Rating.  
Rating is a picklist field.

When converting a Lead, I would like this field to auto mapped to a Contact "Custom Field (Rating)"  - Also a picklist with same value on the Lead page.

I couldn't find "Mapping Fields" on the leads page when clicking on the button.

Can someone help?
sandip bijlwansandip bijlwan
When you convert a lead, the standard lead fields are automatically converted to the account, contact, and opportunity fields , you can not map standard field. With trigger you can update the value in contact.
Soo Kim 16Soo Kim 16
Can you help to create a trigger? 
sandip bijlwansandip bijlwan
trigger ConRating on Contact(before insert) { 
    Set<id> setAccountId=new Set<id>();
    Map<id,Account> mapAccount=new Map<id,Account>();
    for(Contact con:trigger.New)
    { 
       if(con.AccountId!=null)
       setConId.add(con.AccountId); 
       
    }
    
    for(Account acc:[select id,Rating from Account where id in : setAccountId])
     {
        mapAccount.put(acc.id,acc);
     }
  
   
    for(Contact con:Trigger.New)
    {
        con.Rating__c  = mapAccount.get(Con.Accountid).Rating;
        
    }

}