[SalesForce] Document and ContentVersion

I am trying to understand the relation between documents and contentversion. When i queried documents, it returned 100+ records but when i queried contentversion it returned only 1. Please help me understand the relation between them. Plan is to move to lightning so doing some groundwork. Also i read to write some trigger on documents write it on contentversion. How these 2 are related?

Best Answer

Document

Represents a file that a user has uploaded. Unlike Attachment records, documents are not attached to a parent object.

ContentVersion

Represents a specific version of a document in Salesforce CRM Content or Salesforce Files. This object is available in versions 17.0 and later for Salesforce CRM Content documents. This object is available in versions 20.0 and later for Salesforce Files.

Differences Between Files, Salesforce CRM Content, Salesforce Knowledge, Documents, and Attachments

There is no relation between these 2 objects.

Moving Documents to Salesforce Files

How do I move files from the Documents tab into Lightning Experience?

While there isn’t a one-click solution, you do have some options once you identify the files in the Documents tab that you want to use in Lightning Experience and your communities.

  • Export documents in the weekly export, and then upload the documents into Salesforce Files

  • Use a third-party data export tool from the AppExchange, like FileExporter from Salesforce Labs

  • Use an API-based tool (The Chatter REST API supports uploading asset files.)

Related Topic