There’s a famous quote that states, “with great power comes great responsibility.” While I’m pretty sure the author wasn’t referring to cascade delete functionality when he said it , the quote actually describes this feature pretty well.
Cascade delete- a relational database term used to describe the process by which child records are automatically deleted when their parent record is deleted- is, indeed, powerful. When used intentionally and correctly, cascade delete allows you to reduce the quantity of SQL statements needed to perform delete actions. With cascade delete, Salesforce admins can mass delete records quickly and efficiently, without having to go through each record manually.
However, when data is deleted by accident using this functionality, it can be very disruptive. If you’ve ever deleted an Account in Salesforce and noticed that all of the related Contacts and Opportunities have also been deleted, then you’ve experienced cascade delete at work.
While most Salesforce admins are aware that this phenomenon exists, many have not considered the implications of cascade delete from a data protection standpoint. This post will explain the risks that cascade delete can have on your data, and some tips to mitigate that risk.
How Cascade Delete Poses a Risk To Your Salesforce Data
Cascade delete, while useful for intentional deletions, increases the number of items that can be accidentally deleted without an admin noticing. In cases of accidental deletion, admins may miss the associated deletion of any child or grandchild objects, making it difficult to identify exactly which data was lost.
Cascade delete also bypasses security and sharing settings, which means that users can delete records when the target lookup record is deleted even if they don’t have access to the records.
To put the consequences into perspective, consider this hypothetical scenario with a Salesforce org that has an average of three Contacts per Account, and four Opportunities per Account:
A sales rep who is new to Salesforce accidentally deletes 500 of his customer accounts.
Not only have the 500 Accounts been deleted, but because of cascade delete, 1500 Contacts and 2000 Opportunities have also been deleted.
Those 500 Accounts have now, literally, cascaded into 4,000 deleted records.
Not to mention all of the orders, contracts, tasks, and other custom objects that were not included in the scenario
AND don’t forget that all of those records were used to drive reports and dashboards that help you and your management team understand trends, and manage sales.
Now those 500 deleted Accounts are a much bigger problem than you may have originally thought.
A Cascade Deletion Makes It Difficult To Recover Lost Data
Restoring accidentally deleted Salesforce data is a manual and labor intensive process, and cascade delete can compound the process. First, you would need to go through your backups (assuming you have them) to find all of the accounts that were deleted and restore them. But that’s just the accounts, and since you’ve just basically created them again, they all have new Salesforce IDs.
Next, you’ll have to continue digging through your backup files and searching for all of the contacts, opportunities, and custom objects that were associated with those accounts, and update them one table at a time with the new Account IDs. When restoring the data, not only do you have to go object by object and one data table at a time, you must also restore the data in the correct order otherwise the relationships will not align. Even if you are an excel wizard, this could take days or even weeks to complete, and if your database is big enough you might not even be able to use excel at all.
Complicating things further, most Salesforce admins and developers build custom apps that almost always include custom Objects and lookup relationships to other objects. That means that your custom business applications may be completely exposed to the effects of cascade delete as well.
Eliminate Data Downtime with OwnBackup
Cascade delete functionality can be powerful – in both good and bad ways. But by having a cloud data protection solution in place, like Salesforce recommends, you can restore deleted data quickly and easily.
At OwnBackup, we can help you minimize the effect of an accidental data deletion by proactively backing up your Salesforce data. We perform daily, scheduled backups of all of your data, metadata, and attachments, minimizing the opportunity for significant data loss. You can also run an on-demand backup at any time. Just click a button to back up any or all data at any time instantly.
If you suspect something did go wrong, or you made an error, those mistakes are easy to identify as well. Visual graphs illustrate how data changed over time, making it a snap to pinpoint when unusual behaviors occurred.
When it comes time to recover your data, maintaining data integrity is key. With OwnBackup, you can be confident knowing that your data will be recovered, with relationships intact, up to five levels deep. You can go back in time to restore the exact data you need without rolling back all of your records.
For a comprehensive guide on backing up your Salesforce data, view our eBook.