How to mass delete only one particular field value (for all records)?

I have a custom object, one of the field in it is email, all the values saved in this email field got corrupted. Not all the records are having email value. Irrespective of that, I have to clear/empty entire email field values for all records. What is the best approach for doing this. TIA. NOTE: My problem is not mass deleting entire records(Only 1 particular field of all records)

asked Jun 6, 2022 at 4:12 29 4 4 bronze badges

2 Answers 2

  1. Download Salesforce Data Loader.
  2. Authenticate to the Salesforce org that needs data to be updated.
  3. Extract the records from the object by pulling only the Id and the Email fields.
  4. Empty or Null the values in the Email column and make sure the Insert NULL values settings are turned on as documented.
  5. Upload the Data using the "UPDATE" operation.

MASS DELETE ONE PARTICULAR FIELD VALUE FOR ALL RECORDS = UPDATE ONE FIELD (OR COLUMN) FOR ALL RECORDS

answered Jun 6, 2022 at 4:34 Mohith Shrivastava Mohith Shrivastava 91.6k 19 19 gold badges 159 159 silver badges 213 213 bronze badges + Settings | Insert Null values help.salesforce.com/s/articleView?id=000327368&type=1 Commented Jun 6, 2022 at 18:07 +1 on this comment. Commented Jun 7, 2022 at 3:21

Alternatively a batch class can be written that will query all records that are having value in Email field. Iterate over all the records and set the value to blank and update the list as required.

Downside of this approach is to have the test class as well and this involved deployment in production and then post completion of operation batch class needs to be deleted.

This approach is effective only when the data is size is very large, running in millions. Otherwise data loader approach is more effective in my view.

Generally for all such scenario I always create and push the batch class that updates the any field of any object basis the criteria defined.