+ Start a Discussion

Lead Conversion for SIC Code

Hi all,

I am trying to write a trigger to allow a custom Leads field (SIC Code) map over to the Account field SIC Code. How could I write this trigger?

Thank you.
You don't need trigger code to do this. Following the below step to mapp the lead fields to Account object field while converting the lead records
  • Go>Setup>Customize>Lead>Fields
  • Then under the custom field section, click 'Lead Map fields' &then map the lead fields into account or contact object
Next time if you convert the lead records, then custom lead field value will be autopopulated to account record. 
Thanks. I have tried that and it only allows me to map my custom field in Leads to other custom fields in Accounts. I have replicated the exact format that is in the SIC Code setting (Text- 20 characters) and nothing comes up. Any thoughts?
Gabriel KaneGabriel Kane
I have the same problem. Any answers?
trigger trigMapFields on Lead (before update)
    //map to hold convered lead's account Id as key with custom lead SIC as value
    map<id,string> convertedLeadSIC = new map<id,string>();
    //list to collect accounts to update
    list<account> acctList = new list<account>();

    for(Lead lead:System.Trigger.new)
        if (lead.IsConverted)
    for(account acc : [SELECT Id,SIC FROM Account WHERE Account.Id IN : convertedLeadSIC.keyset()])
        acc.SIC = convertedLeadSIC.get(acc.Id);
    update acctList;