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$Account
is defined as a polymorphic field that dynamically links the Notes and Attachments to their related Accounts. - Master Property: For Attachments and Notes, the
master
property 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
WHERE
clause 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
restApiBatchSize
for 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, such as ContentVersions
and ContentDocuments
, consider using specialized tools like the core:ExportFiles Add-On, which is designed to handle complex file export scenarios effectively.