Skip to main content

How to deploy Salesforce Libraries (folders and files) with Gearset

Deploying the data for Library files

Written by Kevin Slattery

Salesforce Libraries (the ContentWorkspace object) let you organize Salesforce Files into folders and share them with specific groups of users. Because a library's folder structure and files are Salesforce data, not metadata, they can't be moved with a metadata compare and deploy. They need to be deployed through Gearset's Data deployment tool (Sandbox Seeding).

This article covers deploying the folders and files inside a library. If you're instead deploying files attached to a record (like an Account or Contact), see Deploying ContentDocument / ContentVersion files with Gearset.

Before you start

A few things about how Salesforce stores libraries that affect what you can deploy:

  • The library itself (ContentWorkspace) can't be created through the API, so Gearset can't create a new library on the target org. The target library needs to already exist — create it once manually in the target org (or confirm it's already there) before running the deployment.

  • Folders inside a library are ContentFolder records, and these can be deployed as data.

  • Files are ContentVersion records. When a ContentVersion is deployed with its FirstPublishLocationId pointing at a folder, Salesforce automatically creates the supporting ContentDocument, ContentDocumentLink, and ContentWorkspaceDoc records for you — you don't need to deploy those objects yourself.

Steps

  1. If you haven't already, enable data deployments on your Gearset account.

  2. From the left-hand menu, go to Sandbox Seeding and click Configure data deployment.

  3. Select your source and target orgs and click Configure deployment.

  4. From the object list, select just these two objects:

    • ContentFolder — this deploys the folder structure itself.

    • ContentVersion — this deploys the files, and Salesforce takes care of creating the linked ContentDocument, ContentDocumentLink, and ContentWorkspaceDoc records automatically.


  5. Add filters if you only want to deploy specific folders or files, rather than the whole library.

  6. Continue through the configuration screens and check the deployment plan to confirm the folders and files you expect are included.

  7. Click Deploy.

Troubleshooting

  • "Documents in a user's private library must always be owned by that user" — this happens if you're not the owner of the files you're deploying. Exclude the User object from the deployment on the related objects page to avoid this.

  • Object not showing up in the object list — the object needs to exist (with matching fields) on both source and target, and you need permission to access it. See Which objects and fields can be deployed using Gearset's data loader? for the full list of requirements.

Related articles

Did this answer your question?