1

How can I set (preferably batch-style) default values for custom fields on existing leads? New leads have the default values as set in the field itself, but existing leads just have blank values. Is there a way around that?

  • why not just export via Data Loader to excel, manipulate, and Data Loader update? – cropredy Nov 20 '15 at 23:36
  • Surely there's a better way than that? – okay56k Nov 20 '15 at 23:42
  • How many Leads do you need to touch? – cropredy Nov 20 '15 at 23:43
  • More than 2,000. – okay56k Nov 20 '15 at 23:44
  • 1
    Yep - Developer Console - you can write whatever apex you want and execute immediately. Check out the doc. Of course if your anonymous code has bugs, you'll smash PROD data so take a backup and tread carefully – cropredy Nov 21 '15 at 0:26
1

Several options

  1. Export Leads via Data Loader - manipulate in Excel, then Upload
  2. If you are brave, use Developer Console and anonymous apex. Test out your script in sandbox first and take a backup of Leads beforehand (using Data Loader). The anonymous Apex allows you to do some things easily that would be a pain in Excel but you will have to watch out for Apex governor limits if dealing with a large number of Leads. Some orgs may not permit this by policy.
  3. Write a batch Apex class that process any number of Leads. You'll build this in a sandbox, test thoroughly, and then deploy to PROD. It can be launched from anonymous apex: executeBatch(...).
  4. Use enhanced Lists and various filters to find the Leads that are missing data. You can mass edit up to 200 rows at a time with a couple of clicks. Then rinse and repeat for all Leads. Practical if the number of Leads to touch isn't too large. May need multiple List Views with unique filters to get at all your Leads with missing data
  5. Some various appexchange tools as described here: http://www.salesforcegeneral.com/salesforce-articles/bulk-update-records-in-salesforce.html or https://yashi.com/blog/implementing-mass-update-and-mass-edit-buttons-salesforce or https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003J6KcEAK or https://www.crmfusion.com/demandtools/demandtools-details/

Since you are touching Leads, you may need to turn off some process builder flows / workflow rules that might inadvertently spam the person-behind-the-leads or your sales team

In short, your options are going to be guided by how free you are to smash PROD data without formal processes and by how much logic needs to be applied to set the defaulted values

| improve this answer | |
  • Thanks so much for your options. Really helps me understand what I'm dealing with here. – okay56k Nov 21 '15 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.