This post is a part of the daily blog series
Day #1 – Lead Conversion Mapping To Standard Fields
Today, I was working on lead fields mapping for lead conversion – standard feature, simple right? The standard feature that lets you map Lead fields to Account, Contact and Opportunity objects. (Can be accessed from Setup–> Lead–> Fields –>Map Lead Fields) So, when a lead converts, the field values are copied from Lead to the chosen object’s fields based on the mapping.
Learning: What I’ve learnt is that I “Cannot map lead fields to standard Account fields” – that’s a bummer! So, I couldn’t map Lead’s Account Type field to Account’s Type standard field.
Solution – The workaround I tried was to create a custom field in Account – named Customer Type and map that field to the Lead Type field in the Lead mapping.
Great, but that doesn’t complete the job as the existing accounts do not have any value in this new field. So, I just wrote this simple code to copy all of the ‘Type’ field values to ‘Customer Type’ in all accounts and also replaced the Type field in the Account page layouts with Customer Type. So, going forward we will just use Customer Type instead of the Type field. You should run this code one time in Developer Console –> Debug –> Execute Anonymous Window
|List<Account> accList = [SELECT id,type,customer_type__c FROM account WHERE type!=null LIMIT 200];|
|a.customer_type__c = a.type;|
Read all other tips of the blog series here – A Tip A Day, daily dosage of learning!