Skip to main content

Restoring Content files from an archive

How to restore Content files (ContentDocument, ContentVersion, ContentDocumentLink) that have been archived

Alex Walter avatar
Written by Alex Walter
Updated yesterday

Salesforce manages files through a process where there are multiple linked records involved and it can be a little tricky to navigate. To allow users to have files related to multiple records and have multiple files on any record, Salesforce uses a "many-to-many" relationship using the ContentDocumentLink records. An example below of how the related records (ContentDocument, ContentVersion, ContentDocumentLink) are linked for a file attached to a Case:

This is how the Case looks in Salesforce before archiving:

Restoring files and links only

If you have just archived the files, but not the records they are attached to (eg records like Cases are still in Salesforce), it should show in the policy run like so with ContentDocument, ContentVersion, ContentDocumentLink records into Gearset's archive and the Case records left on Salesforce:

We can represent this in a diagram with the red items representing those in the Gearset archive and the clear items those in Salesforce:

On Salesforce it will look like this:

If you want to restore the files, then find the record, either through search or viewing the policy run and click Restore record/Restore records:

Select the recommended option of Records with dependent objects and Restore records:

Select the ContentDocument and Files (ContentDocument) and click Continue:

After checking which validation rules and automations you want to disable, you will be brought to the summary page, where you can click Deploy data. This will then show a summary of the records to restore (the details of all the records we are deploying are hidden at this stage):

Once restored the summary should show like so:

The record should now be visible in in Salesforce.

Restoring files and links along with underlying records

If you have archived the underlying records, such as Case records, and the attached files, a policy run should show a summary similar to below for the records that were archived. Notice there are Case records along with the ContentDocument, ContentVersion, ContentDocumentLink records:

All of these items are archived and have been removed from Salesforce:

To restore, select the underlying record like the Case and click Restore record/Restore records:

Select the recommended option of Records with dependent objects and Restore records:

Select the Cases and Files (ContentDocument) and click Continue:

After checking which validation rules and automations you want to disable, you will be brought to the summary page, where you can click Deploy data. This will then show a summary of the records to restore (the details of all the records we are deploying are hidden at this stage):

Click Deploy data and once completed, a summary should show like this:

The restored record and attached file will now show in Salesforce:

As always, if you encounter any issues restoring these components, feel free to drop us a message in our in-app chat -- our support team is always happy to assist!

Did this answer your question?