ExportFiles Core Add-On Module.


This module enables the transfer of Salesforce File objects (ContentVersion, ContentDocument, ContentDocumentLink), including the binary data, along with sObject records.

Table of Contents



Minimal ExportFiles Module Setup

To transfer Salesforce Files using the ExportFiles Core Add-On Module, simply declare the module call in your export.json. This minimal setup helps to Upsert Account records and then Insert Salesforce Files attached to these accounts. The files will be automatically linked to the correct records on the target side:

{
  "objects": [
    {
      "operation": "Upsert",
      "externalId": "Name",
      "query": "SELECT Name FROM Account",
      "afterAddons": [
        {
          "module": "core:ExportFiles",
          "args": {
            "operation": "Insert"
          }
        }
      ]
    }
  ]
}

"afterAddons" refers to the OnAfter Add-On event declaration (in the object's scope) where this module is triggered. This is executed AFTER the Account records have been fully processed. For more details, see the list of supported Add-On events.

Full ExportFiles Module Setup

Below is the full list of args properties relevant to the core:ExportFiles module. You can omit the args parameter from the module declaration to use all default settings.

Args Parameter Is Mandatory Data Type Description Default Value Sample Value
deleteOldData No boolean Set to true to delete old target files before uploading new ones false true
operation No Insert / Upsert / Delete / Update Specifies the operation to perform on the Files. This can differ from the operation applied to the parent object. Same as the parent object Update
externalId No string Identifies which field of the ContentVersion object is used to compare the source and target content versions to determine updates. Title Description
sourceWhere No string An extra WHERE clause to filter source ContentVersion records. Always includes 'AND IsLatest = true' to retrieve only the latest version. undefined Title ='sample-image'
targetWhere No string An extra WHERE clause to filter target ContentVersion records, typically used when needing to compare source and target versions. undefined Title LIKE 'sample-%'
maxChunkSize No number Limits the size of data chunks (in Bytes) transferred simultaneously to improve performance. Should not exceed 37MB. 15MB 20MB
maxFileSize No number Controls the maximum size of files (in Bytes) to be transferred. Files larger than this are ignored. Should not exceed 37MB. 37MB 20MB
Notes:
  • The Add-On only operates with files linked to parent object records that have already been uploaded to the Target org.
  • Export of files to or from CSV files is not supported.
    • Upsert: Inserts new files and updates those that have changed in the Source org.
    • Update: Selectively updates changed files without transferring new files.
    • Insert: Inserts all files regardless of their presence in the Target.
    • Delete: Only deletes target files. You can limit the number of files deleted by using the targetWhere property.
  • The Readonly operation is not supported for files.
  • The externalId property is part of the ContentVersion object with the default being Title.
  • The Add-On splits large volumes of input files into smaller chunks to minimize memory usage and downloads binary content in parallel to enhance download speed while maintaining control over parallel downloads.
  • The maxChunkSize parameter refers to the organization of multiple ContentVersions into a bundle sent to the Salesforce server in a single transaction. It is recommended to avoid uploading large files to prevent issues related to system limitations. For more information, see Salesforce documentation on file size limits.

For additional details, see also Supported Add-On API Events.

Last updated on 20th Apr 2024