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)
Use the Salesforce Data Loader.
- Download Salesforce Data Loader.
- Authenticate to the Salesforce org that needs data to be updated.
- Extract the records from the object by pulling only the Id and the Email fields.
- Empty or Null the values in the Email column and make sure the Insert NULL values settings are turned on as documented.
- Upload the Data using the "UPDATE" operation.
MASS DELETE ONE PARTICULAR FIELD VALUE FOR ALL RECORDS = UPDATE ONE FIELD (OR COLUMN) FOR ALL RECORDS
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.