How to recover data (undelete / undo) in Salesforce?
If the data is accidentally deleted in Salesforce or is mass updated wrongly (during data import with update or upsert operation or through an Apex program) then what are the different options that you can have to recover your data or undo the changes?
- If the data is deleted, then you can restore (undelete) the data from the recycle bin (unless of course you have hard deleted it or emptied the recycle bin). Once the records are deleted, it is stored in recycle bin for 15 days
- You can run a SOQL query with IsDeleted = TRUE ALL ROWS and see if you are able to view the deleted data and recover from here
- If you have taken any CSV backup (either manually or through Salesforce s data export option), then you can restore the records from the CSV backup using data loader
- However if any of the above is not an option, then the last resort that you can turn to is to contact Salesforce.com to recover your data. And here is what you should know before you take this route:
- This is NOT FREE and NOT CHEAP there is a minimum charge of USD 10K
- You can specify the date/time up to which the data should be recovered
- Data can be recovered up to 3 months back from the current date for production instance
- Data can be recovered up to 1 month back from the current date for sandbox instance
- This process may take up to 15 business days
- Salesforce will give you a set of CSV files which you will then need to import in your Salesforce org using any import tools. So this service is not like you will have your data back directly in your Salesforce org
- Any relationship (master-detail, lookup) will need to be re-established using Salesforce record IDs or external IDs
While recycle bin and IsDeleted = TRUE are options for undeleting the data, it won t help if you need to undo changes. The only option to undo changes is to have a CSV backup and either update records from that CSV backup or delete current records and re-insert from CSV.
As an Administrator if you are not backing up your data on a periodic basis, then this is a good time to rethink about it. Here are the options that you can choose from
- The simplest option is to turn on the Salesforce data export service. With this option you will have at least a weekly or monthly backup depending on your Salesforce edition. In fact there is no reason why this should not be turned on for any Salesforce production org
- If weekly backup is not acceptable, then you can schedule a daily export using Apex Data Loader. This will involve some time and effort on your part to set this up. But once setup, the whole process can be automated to run on a daily basis. With this option you can either backup the data on a local PC or even think about using cloud services like Amazon Web Service (AWS). (Contact me if you would like to engage me to set this up for your Organization)
- For more sophisticated backup and recovery options, you can explore AppExchange for a suitable 3rd party tool
Whichever method you choose, do not ignore backing up your Salesforce data on a regular basis. This can be a life saver for you and your organization.
If you are still not convinced check out this knowledge article by Salesforce that clearly states While Salesforce.com backs up all data and can restore data, it s important to back up and be able to restore your own salesforce.com data.
Your comments, feedback and suggestions are welcome. If you have any other innovative idea about backing up Salesforce data feel free to share in the comments. If you already have an AppExchange product or an in-house developed product that you can share with others, you are welcome to mention that. But no spamming please !