Salesforce ContentVersion and Attachments Describe and Migration(Import/Export) Steps : jayakrishnasfdc

Salesforce ContentVersion and Attachments Describe and Migration(Import/Export) Steps
by: jayakrishnasfdc
blow post content copied from  Jayakrishna Ganjikunta
click here to view original post

Through this Post , explaining about very clear difference and understanding on Attachments and ContentVersion & ContentDocument.

Few years back when Salesforce moved from classic to Lightning we have new File storage Object called File(ContentDocument). And Attachments are still using in classic version.

In Simple Attachment (classic) <–> ContentVersion (lightning)

Transfer Files to Other PCs with Nearby Sharing in Windows 10 1803
Salesforce Files are available in Files home for users to share and manage. By contrast, an attachment to a record is available only from the record. Uploading a file as a Salesforce File instead of an attachment doesn’t change access to the file. It just makes the file available to share and manage beyond the specific record. This setting applies to Salesforce Classic only. To do update go to Setup –> General Settings

Note: In Lightning regardless of whether the feature is on or off, uploading a document in the Notes and Attachments related list will still result in the document being added as a Salesforce File.



Represents a file that a User has uploaded and attached to a parent object. Attachments now only works in Salesforce Classic.

Field Name Field Label Type Digits Length Precision Scale
Body Body base64
BodyLength Body Length int 8
ContentType Content Type string 120
CreatedById Created By ID reference 18
CreatedDate Created Date datetime
Description Description textarea 500
Id Attachment ID id 18
IsDeleted Deleted boolean
IsPrivate Private boolean
LastModifiedById Last Modified By ID reference 18
LastModifiedDate Last Modified Date datetime
Name File Name string 255
OwnerId Owner ID reference 18
ParentId Parent ID reference 18
SystemModstamp System Modstamp datetime


enter image description here

Content Document: 
It Represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files. The maximum number of documents that can be published is 30,000,000. This object record you don’t have to create. It gets created when you create ContentVersion which is the child of ContentDocument.

Check the Object API :

Content Version:
 Represents a specific version of a document in Salesforce CRM Content or Salesforce Files. In other words, this object stores document information similar like Attachment.

Check the Object API :

It represents a public library in Salesforce Content. This object label as Library in a user interface with the critical prefix 058. This object is generally available in versions 17.0 and higher. This object does not apply to personal libraries. You cannot use API to create entries in this object.

SOQL sample: SELECT Id, Name, Description FROM ContentWorkspace

 This object will share the files with Users, Records, Groups, etc. You can create multiple records to attach the same files between various records. This object store files parent id in the LinkedEntityId field.

Check the Object API :

When you upload documents, Salesforce determines file types: CSV, EXCEL, LINK, PDF, PNG, TEXT, WORD, ZIP, UNKNOWN. If filetype is a link, the ContentUrl field contains a URL, i.e., when you add a website link to the library.

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

Purpose Upload, store, find, follow, share, and collaborate on Salesforce files in the cloud. Publish and share official corporate files with coworkers and deliver them to customers. Create and manage content, known as articles, in a knowledge base. Internal users and customers can quickly find and view the articles that they need. Customers include people on your Customer Portal, partner portal, Service Cloud Portal, or Lightning Platform Sites. Store web resources, such as logos, DOT files, and other Visualforce materials in folders without attaching them to records. Attach files to records from the Attachments related list on selected detail pages.
Common Uses Upload a file and store it privately until you’re ready to share it. Share the file with coworkers and groups to collaborate and get feedback. Attach files to posts in a Chatter feed on the Home tab, Chatter tab, a profile, a record, or a group. Create, clone, or modify a sales presentation and save it so only you can see it and work on it. When you’re ready, publish it so other users in your company have access to it. Create a content pack and send it to customers. Write, edit, publish, and archive articles using the Articles Management tab, or find and view published articles using the Articles tab. If Salesforce Knowledge is enabled in your Customer Portal, partner portal, Service Cloud Portal, or Lightning Platform Sites, customers and partners can access articles. Create a public knowledge base so website visitors can view articles. Add a custom logo to meeting requests by uploading your logo to the Documents tab. Add a file to a specific record, like an event, marketing campaign, contact, or case by attaching it on the Attachments related list.
Supported File Types All All All All All
Maximum File Sizes 2 GB 2 GB 2 GB (including headers) when uploaded via Connect REST API 2 GB (including headers) when uploaded via REST API 38 MB when uploaded via SOAP API 10 MB when uploaded via Bulk API 150 MB when uploaded via Bulk API 2.0 10 MB when uploaded via Visualforce 5 MB 5 MB 20 KB for a custom-app logo 25 MB for file attachments 2 GB for feed attachments

Files and Attachments features

File handling capabilities vary between the Files related list and Attachments related list in Lightning Experience and Salesforce Classic:

In Lightning Experience

  • Files supports:
    • Share via the Files Preview page
    • Download via the Files Preview page
    • Upload New Version via the Files Preview page
    • Delete via the Files Preview page
    • Followers via the Files Preview page
    • Versions via the Files Preview page

Note: The Edit and Delete options within the downward facing triangle icon, on the View All Files page, are greyed out by design.  Edit and Delete operations can be performed on the Preview page for the respective file as stated in the bullets above.

  • Attachments supports:
    • Download
    • View (dependent on browser and settings)

In Salesforce Classic

  • Files supports:
    • Delete
    • Preview
    • Download
    • Sync
    • Edit Details
    • Sharing Settings
    • Upload New Version
    • Followers
    • Shared With
    • Versions
  • Attachments supports:
    • Download
    • View (dependent on browser and settings)

Please refer this post: How to Import & Export Attachments and ContentVersions in Salesforce

Thanks for Reading……


July 15, 2021 at 09:16PM
Click here for more details...

The original post is available in Jayakrishna Ganjikunta by jayakrishnasfdc
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.