As Salesforce administrator I need frequently to mass delete records in Salesforce. This, for several reasons, as cleaning up duplicate, incomplete, or incorrect records and streamlining the workflows.
However, it’s important to approach this task carefully to avoid unintended consequences. In this article, I will share some tips and best practices to help you safely and efficiently delete large numbers of records in Salesforce with confidence.
Why we may need to delete records from Salesforce
There are several reasons why we may need to mass delete records in Salesforce:
- Data quality: As a Salesforce admin, you will likely receive, as I do, requests from sales teams related to maintaining data accuracy and integrity. It’s essential to delete duplicate, incomplete, or incorrect records. These records can cause confusion and mislead sales and marketing efforts, resulting in poor data quality.
- Data storage limits: Depending on the type of license you have, Salesforce limits the amount of data you can store. So, when your storage limit is reached, you may need to delete old or unnecessary records to free up space for new data.
- Compliance with data retention policies: Many companies have retention policies that require them to delete certain types of data after a specific period. For example, they may need to delete customers or users data after a certain number of years to comply with data privacy regulations.
- Mergers and acquisitions: When companies merge or acquire another company, they may need to delete duplicate or unnecessary records. This, in order to streamline their data and avoid confusion. I personally experienced this subject :).
- Testing: When testing new features or integrations, I create some unreal data. So, I need then, to delete them.
To mass delete records in Salesforce, you can use the Data Loader tool or the Mass Delete Records feature.
Option1: Bulk delete records in Salesforce using Data Loader tool
Here are the steps to use the Data Loader tool to mass delete records:
- Install the Data Loader tool from the Salesforce AppExchange.
- Create a CSV file with the IDs of the records you want to delete. To do this, you can create and then export a report from Salesforce. You should use appropriate filters to list only the data to be deleted.
- Open the Data Loader tool. Then, Log in to the production environment with your admin account from the Data Loader tool and grant it access to manage data.
- Choose the type of action you want to perform. In this case, click the “Delete” button.
- Select the object you want to delete records from.
- Map the fields in your CSV file to the corresponding fields in Salesforce. In this case, you will need to map only the object ID.
- Start the delete operation.
Option2: use the Mass Delete Records feature
Here are the steps to use the Mass Delete Records feature in Salesforce:
- Go to Setup in Salesforce.
- Search for “Mass Delete Records” in the Quick Find box and select it.
- Choose the option related to the object you want to delete records from. As you can see from the image above, there are many options such as: mass delete accounts, mass delete leads, mass delete activities, etc.
- Create a filter to identify the records you want to delete. This is done, in step 3, which is highlighted in the image above.
- Preview the records to be deleted.
- Confirm the deletion.
Tips for Safely Mass Deleting Records in Salesforce
Here are some tips and best practices, based on my experience, to help you safely and efficiently delete large numbers of records in Salesforce with confidence:
- Test all the mass delete manipulations in the test sandbox. This will give you the opportunity to spot and resolve any issues ahead of time. SO; that you can delete your data with confidence in the production instance. This approach allows you to reduce the risk of data loss or corruption. Sandbox testing is good practice in Salesforce administration.
- Be careful when using bulk deletion features. As far as I am concerned, I do not check the option underlined in the image below which allows the deletion of records permanently. Because, the operation cannot be undone.
- Before deleting data, I strongly recommend that you back up records by exporting reports that contain data that will be deleted.
- When it’s time to delete your data in the production instance of Salesforce, I recommend following these steps to avoid potential issues:
- Start by deleting a single record and verifying that everything went as planned. Even if you’ve already tested the process in your sandbox environment, it’s always a good idea to double-check in production.
- Instead of deleting all your data at once, divide it into several parts. This way, if you encounter any errors during the removal process, you can avoid the worst. Note that if you opt like me for the option “Mass Delete Records feature”, there is already a limit of 250 records.
I hope these tips and best practices will help you securely and confidentially delete your records in Salesforce. You can check my other tutorials of this tool in the Salesforce category.