Loading

Recover records and data in Salesforce

Udgivelsesdato: Jun 26, 2024
Beskrivelse

Learn how to troubleshoot missing data or records in Salesforce, and the steps to recover them if possible.

Løsning

Initial Troubleshooting:

 

Before opting to recover data, you can perform the following steps to confirm that the data is gone.

 

  1. Determine if the records have been transferred to another User and out of your view. You can do this by reaching out to a system administrator or other User with View All Data on the object to see if the record still exists.
  2. If you’re looking for the records in a related list, check to see if they can be found through another method. For example, can you find them by using Global Search?
  3. If you can find the data through search, it may have been reparented to another record, resulting in it disappearing from the expected related list.
  4. Ask your Salesforce system administrator if any changes have been made to the organization's sharing rules that would affect your visibility into the records.
 
Note: It may be helpful to have a system administrator or other User with View All access in the organization perform the search. If you no longer have access to the record but it does exist, Users with View All should still be able to find it through search and confirm.
 

Data Backup:

After your review, if you have determined that the data or records have actually been deleted, follow these steps to determine if the information is available for recovery through other means.
 

  1. Access the Recycle Bin and change the drop down menu to All Recycle Bin. Search for the missing records, or sort the data to manually review the deleted records. Review Recycle Bin. If the record is visible in the Recycle Bin, select that item and click Undelete to restore it, review View, Restore, and Manage the Recycle Bin in Salesforce Classic. If there are too many records to undelete manually in the Recycle Bin, you may be able to use Workbench, review Restore multiple records that are in recycle bin.
  1. Request that your system administrator (or another User with API access and View All Data on the object) check for deleted records using the 'Export All' function in Data Loader as outlined in the Export Data documentation.
When records are purged from the recycle bin, they might still be visible through API until they are completely purged from the organization. Users with View All Data and API access can check for records in this state by using Export All in Data Loader, and filtering on isDeleted = True.
Note: If the records do not exist in the Recycle Bin, but they do exist when querying isDeleted = True in Data Loader, the records cannot be undeleted. However, they can be exported using Data Loader, and then recreated. Also, the deleted record could have been a Child record that was deleted because the Parent record is deleted. If this is the case, look for the parent record in the recycle bin then recover the parent record instead. This should automatically recover the deleted child records as well.
  1. Reach out to your system administrator to see if a Data Export has been performed recently to back up the organization's data. They might have performed the export using the Weekly Data Export built into Salesforce, or using a third party app from the AppExchange. If you are able to find the data within an export backup, that information can be used to recreate the records in the organization.
  1. Check with your system administrator to see if a Full sandbox has been created recently. Unless a template was used to exclude objects, Full sandboxes copy all data that existed in the production organization at the time the sandbox was created or refreshed. If the data exists in a recent sandbox copy, you can download the data from the sandbox to recreate it in production.
    Note: Data ExportsService is not available in sandbox. Instead, use Data Loader or a similar API tool to download the data from the sandbox and recreate it in production.

Recreate the data:

If you are able to find a backup of the missing records or data using one of the above methods, you can recreate the records by Choosing a Method for Importing Data. There are a few considerations to keep in mind:
 

  1. All recreated records will receive a new unique record ID at the time they are recreated. This needs to be taken into consideration when restoring data with relationship to other records. For example, if you’re restoring an Account and its child Contact records, you should restore the Account first, edit your Contact recovery file to change the Account ID to the newly created Account's ID, and then restore the Contact records.
  2. Replacing or updating prior record IDs with new record IDs will need to be done externally using Excel's vlookup function or alternatively, an administrator may consider creating a custom External Id field to store prior record Ids for use in relating records to one another upon re-import. See Insert, Update, or Delete Data Using Data Loader for more details on using an external Id field for matching each related object's records on Upsert.
  3. If you were able to find a backup containing the original CreatedByID, CreatedDate, LastModifiedId, and LastModifiedDate information and would like to retain those details, see Enable 'Create Audit Fields' to recreate the records with their original historical information.

 

Why did this happen to begin with?

Because some of the options for recovering the data are time sensitive, we do recommend that you look into the recovery first or at least in conjunction with your investigation into why it happened. Here are some things to look into as potential causes for records to be deleted:
 

  1. Check for any integration or third party applications that directly affects the missing records (e.g. Salesforce for Outlook could impact such as Tasks, Events and Contacts). These apps could update or even delete Salesforce records, depending on its configuration. If you have an example record that is in the recycle bin or hard deleted query its audit System Fields values to cross reference the LastModifiedById user's login history for the record's LastModifiedDate to see if there are any corresponding logins attempts for apps or integrations leading up to or before the record was deleted.
  2. Check to see if the object has a master-detail relationship with another object. If it does, was the master record for the missing records deleted? For example, if you delete an Account any Contacts associated with the Account will also be deleted. When this occurs, the child records will not appear in the Recycle Bin. Instead you will only see the parent record. Restoring the parent record will automatically restore any child records that were a part of the cascade delete.
  3. Have your system administrator check the Setup Audit Trail to determine if the object containing the missing records was deleted. Deleting a custom object will automatically delete records in the object. This might have been done through the objects page in Setup, or as part of a package uninstall.

Related Information: Variations of Deletion behavior

  1. If a child record (like a Contact or Opportunity) is deleted and the parent record is subsequently deleted (Like the Account), the child record is permanently deleted. Even if the parent record is undeleted, the child record cannot be recovered, but if the child record is undeleted first this won't happen.
  2. When a parent account is deleted, all the links to the child accounts are removed and also deleted. If that account is subsequently restored from the recycle bin, the previous children accounts and their relationship to the parent record are restored.
  3. Record data has 3 stages of deletion:
  • Stage 1 - Deleted and sent to Recycle Bin or soft deleted - Data in this stage can still be recovered from the recycle bin or via the API via an undelete() call.
  • Stage 2 - Emptied from the Recycle Bin or hard deleted - Data in this stage cannot be recovered from the recycle bin or undeleted but can be exported from the API using Export All via Data Loader or queryAll() using alternative API client tools.  Records can skip the recycle bin and be put in this state directly by using the 'Hard Delete' option in the Data Loader.
  • Stage 3 - Physically/Permanently deleted - Data in this stage has been wiped from database.
 

See also:
How to Export a Deleted Record Using Data Loader
BEST PRACTICES: Data backup and recovery best practices
Unable to restore a deleted record from the Recycle Bin
Protect Your Data with Salesforce Backup and Restore
Restore Connected Accounts in the Salesforce Authenticator Mobile App

 

Support Videos:
How to Find out Who Deleted a Record in Salesforce
How to Restore Records from the Recycle Bin

Yderligere ressourcer

Recover Data from Recycle Bin

Vidensartikelnummer

000384460

 
Indlæser
Salesforce Help | Article