Note: This article covers Salesforce Files (Lightning files), stored as ContentDocument and ContentVersion records. For other binary data, see:
Deploying file attachments with Gearset (Salesforce Classic attachments)
How does Salesforce store Files?
Salesforce stores each file across three objects:
ContentVersionholds the file data.ContentDocumentholds details about the file, such as who created it.ContentDocumentLinklinks the file to a record, such as anAccountorContact. One file can have several links. See ContentDocumentLink in the Salesforce Object Reference.
Files uploaded to a record's Files related list always become Salesforce Files, in both Lightning Experience and Salesforce Classic.
Which tool should I use?
Sandbox seeding and data deployment both move records between your orgs, and both are part of the Sandbox seeding & compliance add-on. They are built for different jobs, and they handle Files in different ways.
Sandbox seeding is designed to seed test data from production or another sandbox into a development sandbox. You build the job on a canvas, starting from one object and adding its parent and child objects. Files appear as one child object called Files, which includes ContentDocument, ContentVersion, and ContentDocumentLink. You add it in one step.
Data deployment deploys selected records and their related records from one org to another. A team owner can also allow deployments to production orgs. Files are not grouped, so you add ContentDocumentLink and then select ContentDocument and ContentVersion as related objects yourself.
Use sandbox seeding to fill a sandbox with test data. Use data deployment when you need finer control over each object, or when the target is a production org.
How do I deploy Files with sandbox seeding?
In sandbox seeding, ContentDocumentLink does not appear in the object list. Gearset groups the three Files objects into one child object called Files.
Configure your sandbox seeding job. See Running your first sandbox seeding job.
Select the start object that owns the files, for example
Account. Add filters if you only need some records.Add
Filesfrom the start object's child objects.Continue to masking and deploy as usual.
How do I deploy Files with data deployment?
This example deploys Account records and their files. The same steps work for Opportunity, Lead, Contact, or any custom object.
On the first page of the data deployment, add the object that owns the files, for example
Account. Add filters if you only need some records.Add
ContentDocumentLink.Enable the
Filter using parent objectfilter onContentDocumentLink. Gearset then deploys only the files linked to the records in this deployment.
On the related objects page, set
ContentDocumentLinktoCreate new records. Gearset deploys binary objects only with a create step.Select
ContentDocumentandContentVersionon the right-hand side. Salesforce creates the files only when all three objects are selected.Check that
ContentDocumentusesRead back created records. Salesforce createsContentDocumentrecords in the target org, so Gearset reads them back instead of deploying them.
How do I check that the files will deploy?
Open the deployment plan. Look for these two steps:
A fetch step filtered by the parent object
A
create binarystep that deploys the file
What are the limitations?
You can configure the deployment for one object at a time, for example all files attached to
Account.Gearset deploys only the latest version of each file.
Why do I see "Documents in a user's private library must always be owned by that user"?
This error appears when you are not the owner of the files you deploy:
Documents in a user's private library must always be owned by that user
To fix it, exclude the User object on the related objects page. Gearset then sets your deployment user as the owner of the files, and does not try to store them in the original owner's private library.
If this doesn't change anything, please send a message to our support team, who will be happy to help.







