You need to sign in to do that
Don't have an account?

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.
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.
- 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.{
//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)
{
convertedLeadSIC.put(lead.ConvertedAccountId,lead.SIC__c);
}
}
for(account acc : [SELECT Id,SIC FROM Account WHERE Account.Id IN : convertedLeadSIC.keyset()])
{
acc.SIC = convertedLeadSIC.get(acc.Id);
acctList.add(acc);
}
update acctList;
}