How to Delete the Records Using Data Loader in Salesforce

In Salesforce, we can delete mass records using the Mass Delete Wizard which can be accessed from Data Management > Mass Delete Records but there is a limitation of deleting 250 records at once using the Mass Delete Wizard and it only allows to delete Accounts, Contacts, Leads, Activities, Cases, Solutions, and Products records.

If you want to delete a high volume of records like more than 250 records then Data Loader is going to help in performing the delete operations of object records and unlike Mass delete wizard, Data Loader can access and delete records of custom objects also.

In this Salesforce tutorial, we are going to learn about the method to Delete the records using the Data loader in Salesforce.

Deleting records with Salesforce Data Loader

In Salesforce, Data Loader is a powerful tool used for importing, exporting, and deleting records. It is preferred when it is required to perform mass deletions of standard and custom object records in Salesforce. While deleting the data with data loader it is always suggested to keep the backup of data because the deletion cannot be undone.

Considerations

Below are some considerations to keep in mind when deleting records using Data Loader.

  • Before initiating any delete operation, always keep a backup of the data.
  • Check the dependencies on the records that you are going to delete. If the record is referred to in workflow rules, processes, validation rules, or in relationship with another object then it will not get deleted and give error.
  • Make sure that you have the necessary permissions to delete records. Without the appropriate permissions, the delete operation may fail.
See also  How to Mass Deactivate users in Salesforce via Data Loader

Delete the Records Using Data Loader in Salesforce

In this scenario, I will explain the deletion of the Records using the Data Loader for the Leads record.

To delete the record, we need to prepare a CSV file in our system and the easiest way to get the subset of records you’d like to delete is by exporting details of that object.

In this example, I have exported a few Lead records. The only column you need in the report is the Lead ID field (Record ID).

1. To export the records go to Data Loader and select Export -> select browse location for extracted records -> click Next.

2. Select the ID field, and the name field then click on the Finish button.

Delete data records in Salesforce with data loader

3. Now open that exported data in a CSV file and copy the header column and ID of the records that you have to delete.

Create csv file to delete a record in Salesforce with data loader

4. Now open a new CSV file and paste the header column ID and under that paste the ID of the records that you have to delete.

After this save this CSV file from where you can access it with the data loader.

Salesforce Records delete with data loader

5. Now open the data loader and log in with your credentials. Then on the setup of the data loader click on the Delete button.

Delete multiple records in Salesforce with data loader

6. In this step, select the data object in which you have to delete records. In this example, I have selected the Lead data and then chose the CSV file that we have created above.

After this click on the Next button.

Delete records in bulk with data loader in Salesforce

7. In this step, we will do the mapping between the object fields and the header column in the CSV file that we have created, and for that click on the button Create or Edit a Map.

See also  How to Mass Delete Leads in Salesforce

In the Mapping Dialog window click on the button Auto-Match Fields to Columns. If the field name is not auto-matched then you have to drag and drop the fields according to the CSV column headers.

After mapping click on the OK button then click Next.

Map object fields in data loader to delete records in Salesforce

8. In this window, select the file location for the error and success CSV files that can be accessed later. After this click on the Finish button.

Mass delete records in Salesforce using data loader

9. In the warning message, click on the Yes button to proceed with the delete operation.

Data loader bulk delete Salesforce records

10. After the completion of the delete operation, we get a message of completion. Here, click on View Success if your records were successfully deleted.

Data loader delete operation in Salesforce

Now you can view the status of success in this csv file as shown in the below image.

Delete mass records using data loader in Salesforce

11. To view the deleted records go to the setup page of Salesforce, and in the Quick Find box search then select

View Records deleted by data loader in Salesforce

Now we can view the deleted records in the Recycle Bin which means we have successfully deleted the records using the Salesforce Data loader.

In this way, we can delete the records using a data loader in Salesforce.

Conclusion

In this Salesforce tutorial, we have learned about the method by which we can Delete the records Using Data Loader in Salesforce and the steps that we have followed are applicable to delete records of any standard or custom object.

We also discussed the considerations we should be aware of to avoid unintended consequences while performing the delete operation with Salesforce Data Loader.

See also  How to Mass Delete Opportunities in Salesforce using Data Loader

You may like to read