Export of the Notes, Attachments and Files.
Table of Contents
Overview ⇧
Purpose: This guide provides an example configuration for including Note and Attachment objects in a Salesforce data migration, specifically tailored to export these items along with associated Account records, including the binary data of the Attachments.
Exporting Notes and Attachments ⇧
Below is an example of an export.json configuration designed to export Attachments and Notes related to Account records:
"objects": [
{
"operation": "Insert",
"query": "SELECT Id, Name FROM Account"
},
{
"operation": "Insert",
"query": "SELECT Body, Id, Name, ParentId$Account FROM Attachment",
"master": false
},
{
"operation": "Insert",
"query": "SELECT Body, Id, Title, ParentId$Account FROM Note",
"master": false
}
]
Notes:
- Polymorphic Field: The
ParentId$Accountis defined as a polymorphic field that dynamically links the Notes and Attachments to their related Accounts. - Master Property: For Attachments and Notes, the
masterproperty is set tofalse. This setting enables the automatic selection of records related to the primary Account records. - WHERE Clause: To further refine the selection of Attachments and Notes, you can incorporate a
WHEREclause to filter records based on specific criteria. - Handling Large Files: If Attachments or Notes contain large file sizes which could potentially cause script execution failures, it is advisable to adjust the
restApiBatchSizefor these objects. Setting this parameter to a smaller number, such as 5 to 10, can help ensure a smooth migration process:
{
"operation": "Insert",
"query": "SELECT Body, Id, Name, ParentId$Account FROM Attachment",
"master": false,
"restApiBatchSize": 10
}
Exporting Salesforce Files ⇧
For exporting Salesforce Files, use the core:ExportFiles Add-On, which is designed for current engine file pipelines (ContentVersion, ContentDocumentLink, Attachment, Note) and supports org/csvfile scenarios.
Deprecated for complex file migrations: direct object-level SOQL-only file transfer flows are legacy-style and should be used only for simple cases.
Notes:
- For most production migrations, prefer
core:ExportFiles, because it handles file links and binary payload flow in a dedicated pipeline. - Use direct object-level file queries only for lightweight or legacy scenarios where no advanced file handling is required.
- If your migration includes multiple object sets and CSV media,
core:ExportFilesaligns better with current object-set path behavior.