ContentVersion (Salesforce Files)
ContentVersion represents a specific version of a file in Salesforce Files.Required Fields for Export
| Field | Type | Description |
|---|---|---|
Id | ID | Unique record identifier (18-char) |
ContentDocumentId | ID | Parent ContentDocument ID - Required for download |
Commonly Used Fields
| Field | Type | Description |
|---|---|---|
Title | String | File title (without extension) |
FileExtension | String | File extension (pdf, docx, etc.) |
ContentSize | Integer | File size in bytes |
VersionNumber | String | Version number (e.g., “1”, “2”) |
IsLatest | Boolean | Whether this is the latest version |
CreatedDate | DateTime | When the version was created |
CreatedById | ID | User who created this version |
LastModifiedDate | DateTime | When last modified |
LastModifiedById | ID | User who last modified |
Additional Fields
| Field | Type | Description |
|---|---|---|
Description | String | File description |
PathOnClient | String | Original file path when uploaded |
FileType | String | File type category |
PublishStatus | String | Publishing status |
VersionData | Base64 | The actual file content (binary) |
Checksum | String | MD5 checksum of file |
Attachment (Legacy Attachments)
Attachment represents legacy file attachments from before Salesforce Files.Required Fields for Export
| Field | Type | Description |
|---|---|---|
Id | ID | Attachment ID (starts with 00P) - Used for download |
Commonly Used Fields
| Field | Type | Description |
|---|---|---|
Name | String | File name (including extension) |
Body | Base64 | The actual file content (binary) |
BodyLength | Integer | File size in bytes |
ContentType | String | MIME type (e.g., “application/pdf”) |
ParentId | ID | ID of parent record (Account, Case, etc.) |
CreatedDate | DateTime | When attachment was created |
CreatedById | ID | User who created attachment |
LastModifiedDate | DateTime | When last modified |
LastModifiedById | ID | User who last modified |
Key Differences from ContentVersion
| Feature | ContentVersion | Attachment |
|---|---|---|
| Versioning | ✅ Yes (IsLatest, VersionNumber) | ❌ No |
| Field Name | Title + FileExtension | Name |
| Size Field | ContentSize | BodyLength |
| Extension Field | FileExtension | None (parse from Name) |
| Download ID | ContentDocumentId | Id |
| Parent Link | via ContentDocumentLink | Direct ParentId |