If you have the possibility to delete all Salesforce data, that means that you are someone important, maybe a Salesforce Admin. If you are not, then someone did not spot something and gave you too much power, because as the well-known saying goes: “With great power comes great responsibility.”
In this section, we will detail the following few ways in which data can be deleted from Salesforce:
- Deleting records manually
- Mass deleting records via Data Loader
- Flow Delete action
No worries; we will also see how to rescue the deleted data.
Deleting records manually
As simple as it may seem, you may have the right to delete records manually, one by one. It sounds like an obvious feature; if someone can create records, they should also be able to delete them. However, in the Salesforce world, to be able to delete records on some objects, the user needs to have the proper permissions. Permissions come separately for each object and can be assigned to the user, for example, via Permission Sets. The object permissions that can be used to permit users to delete records are as follows:
- Delete – The permission that permits users to delete records on a specific object.
- Modify All Data – God mode on the level of Salesforce objects. The user with this permission can edit and delete all records on a specific object.
Mass deleting records via Data Loader
Imagine you need to delete 10 records from Salesforce. Of course, you can do this one by one. Easy-peasy. But try doing the same with 100 or 1,000 records. Yeah, it’s still easy, but incredibly time-consuming. Now, let’s imagine you’d prefer to enjoy a good coffee break in the office instead of clicking the delete button in Salesforce 1,000 times. Not so hard to imagine, right?
If you’d like to delete records more efficiently, then you need to perform this as a mass action. This can be achieved by using the good old desktop-only Data Loader.
To delete records via Data Loader, you need to follow the following steps:
- Export the Salesforce record data that you need to delete. You can use Report exports or Data Loader to export this data. What is important is the Salesforce record ID needs to be included in the export data.
- Use the delete feature in Data Loader. It works similarly to importing, which was described in the previous part of this chapter, but instead of inserting data that should be imported or updated, you will use the report of records that need to be deleted. That’s why you needed the record IDs when you were exporting the data. Based on the IDs, Salesforce will know which records need to be deleted.