So obviously I can create a new checkbox field that defaults to true - but is there a way to actually "insert" a field's default value retroactively into all old records on creation of that field? Or is there no way around updating all the old records manually?

The reason behind this is that records often hold implicit values and over time, as new possibilities get added, a field gets added to reflect that. For example you would create "Is Active" where all old records have always been active and now you suddenly can change this - so a checkbox is introduced (but this is true for every other type of field as well).

SQL actually does this if you make a field NOT NULL but in Salesforce this does not seem to work (and you cannot make checkbox fields mandatory anyway as NULL is not allowed there). Any ideas on this one?

1 Answer 1


Salesforce does not have a OOTB solution for this. Your best bet would be to run a script like below in the Anonymous window and update the new field en masse.

List<sobj> objList = [SELECT Id, new_field__c FROM sobj LIMIT 10000];
List<sobj> objListoUpdate = new list<sobj>();
for(sobj rec: objList) {
    rec.new_field__c = true; //or false

update objListoUpdate;
  • or Data Loader (or its equivalent)
    – cropredy
    Commented Feb 22, 2022 at 17:53
  • I feared that this would be the only solution. Thanks for the suggestions anyway.
    – Semmel
    Commented Feb 22, 2022 at 23:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .