How to set a retention policy for Salesforce backups

How to set a retention policy for Salesforce backups

Catherine Bacon & David Runciman on

Share with


When you’re setting up a backup job in Gearset, you can select a retention policy. If you’re not sure exactly how long you should keep backup data for, don’t worry - this is quite common. In this post, we’ll explain how retention policies work and what you normally need to think about when setting a retention period. Make sure you also talk to your company’s compliance and data protection officers - retention policies usually fall within their remit.

How do retention policies work?

The retention policy you set for your backup job determines how long backup data is kept before it’s deleted from your backup history. In effect, a retention policy gives you a rolling period of backup history you can restore data from.

Back to the future car

How do retention policies affect when data will be lost forever? Gearset deletes records and objects from your backup history when they haven’t appeared in any backup runs for a period exceeding your retention policy.

Let’s say you set a 7-year retention policy. Any records or objects you’ve deleted from your org will still be available for you to restore if needed for 7 years after the deletion. If you change a record in your org, the old version of that record will be available to restore for 7 years afterwards. After the 7 years, those records and objects will be lost forever - unless they are restored first.

Live eventConvene, Chicago

DevOps Dreamin’ Chicago 2024

Find out more

Factors to consider when setting retention periods

Data restore

The first and most obvious thing to think about is all the possible data that you might need to restore at some point in the future. You never want to be in the position where you need to restore data, only to find it has been purged from your backups.

A good starting point is to work out the oldest data you’d ever need to restore. Most companies won’t need to be able to restore data they deleted from their orgs years and years ago. These questions could be useful to answer:

  • What’s the oldest backup we’ve ever needed to restore from?
  • Why did we need to restore from that backup?
  • If a similar use case arose, might we need an even older backup and, if so, how old?


Retention policies are often needed to make sure your backups comply with data protection legislation. There are different regulations that may apply to your company. Some regulations enforce a minimum period, while others constrain how long you should keep backup data.

In the US, minimum retention periods are specified in industry-specific regulations, such as HIPAA for the healthcare sector and SEC Rule 17a-4 for finance. And then there are state laws that also specify minimum retention periods, such as CCPA.

The European Union’s GDPR, on the other hand, stipulates that personal data should be kept ‘for no longer than is necessary’. This regulation applies to any companies processing data for residents of the EU and EEA, no matter where the company is based. What this means in practice will depend on the nature of your company and how it handles personal data. But the intention behind the regulation is clear: there should be a limit on how long you keep backup data.


Depending on how you back up your org’s data and metadata, the cost of storage may also be a reason to set a shorter retention period. In practice, many backup solutions - including Gearset - don’t charge you according to the amount of data you back up. But where that’s not the case, or where teams are running backups manually, a retention policy that purges outdated backups will stabilize storage requirements and limit costs.

Finding the right balance

Making sure backups are there when you need them will always push you towards a longer retention period. Compliance with different regulations will generally pull you back towards a shorter retention period, although perhaps with a minimum period. And cost, where relevant, may also pull you towards a retention policy that purges unnecessary, outdated backups. The challenge for each team is to work out how these competing concerns fit together in your case.

By default, Gearset suggests a retention period of 7 years. Importantly, this meets the minimum requirements of key regulations that apply to many companies and sectors globally, but doesn’t push further and risk breaching regulations such as the GDPR. A period of 7 years also gives you ample time to discover deleted data that you might need to restore.

Gearset's UI for creating a backup job

Ready to secure your orgs?

Join our upcoming webinar How to choose a backup solution for Salesforce on May 28th, and get the practical advice you need to select a backup solution that fits your unique Salesforce requirements.

Or if you’re ready to try Gearset’s backup functionality, try it for yourself with a 30-day free trial.

Try all of Gearset for free