The core:ExportFiles Add-On Module.

This module allows you to transfer the salesforce content objects (ContentVersion, ContentDocument, ContentDocumentLink) including the binary data with the main sObject records.

This module is based on the Core SFDMU Add-On Api.

Minimal module setup.

In order to transfer salesforce Files by using the ExportFiles Core Add-On Module, you should simply declare the module call in your export.json.

This small setup will assist you to Upsert the Account records and then to Insert the salesforce Files, attached to these Account records. The Files will be automatically linked to the proper records on the Target side:

 "objects": [
         "operation": "Upsert",
         "externalId": "Name",
         "query": "SELECT Name FROM Account",

         "afterAddons" : [
                 "module": "core:ExportFiles",
                 "args" : {
                     "operation" : "Insert"


"afterAddons" - it's the new Add-On module declaration that was added to the export.json specification.

It means the Add-on After Event declaration which defines the array of add-ons, that should be triggered on the given parent object (in our case it is Account) only AFTER the parent object records were fully processed.

  • You can include as many Add-Ons as you wish (in our example we have only one activated Add-On module).

  • The SFDMU Add-On Engine will process all listed modules at the same order as they appear in the event array.

"module": [Mandatory] - The name of the module to trigger.

"args" : [Optional] - The input parameters which are passed to the module on the module run. Each module can be tweaked to the specific needs using args interface.

Full module setup.

Find below the full list of the args properties relevant to the core:ExportFiles module.

To use all the defaults you can omit the args parameter from the module declaration.

Args Parameter Is Mandatory Data Type Description Default Value Sample Value
deleteOldData No boolean true to delete the old target Files before uploading new false true
operation No Insert / Upsert / Delete / Update Which operation to perform on the Files.

It can be different from the operation applied to the parent object.
Same as the parent object Update
externalId No string Which field of the ContentVersion object to use to compare the source and the target content versions to determine whether the source version has changed or does not exist in the Target and so it should be uploaded.
This is similar to the externalId property of the Script Object.
Title Description
sourceWhere No string The extra WHERE clause to process a limited subset of the source ContentVersion records.
The Add-On always adds 'AND IsLatest = true' to retrieve only the last ContentVersion.
undefined Title ='sample-image'
targetWhere No string The extra WHERE clause to process a limited subset of the target ContentVersion records. The Add-On always adds 'AND IsLatest = true' to retrieve only the last ContentVersion.

Typically the Add-On retrieves the target records only when need to compare the source and the target.

In other hand, it is not performed for example for the Insert operation where the Target records does not matter.
undefined Title LIKE 'sample-%'

The additional information and considerations:

  • The Add-On only works with Files linked to the parent object's records. So if you place the "afterAddons" array in the Account object definition, it will transfer only the Accounts which were already processed during the main migration job.

  • You can not export files into the CSV file or import from the CSV. Only the direct org-to-org migration is supported.

  • The Upsert operation will insert the new files and update those which were changed in the source. The files are compared by the defined External Id field. The Update operation will only selectively update the changed files, but will not transfer the new files. The Insert operation will insert all files regardless whether they do exist or not in the Target.

    The Delete operation will only delete the target files. You can limit amount of deleted files by using targetWhere property.

  • The Readonly operation is NOT supported for the Files.

  • The extermalId property belongs to the ContentVersion object field metadata.

  • The Add-On splits high volume of the input Files into smaller chunks to save the runtime memory. In addition it downloads the binary content in parallel threading mode using throttler to upgrade the download speed remaining control over the amount of downloads running in parallel.

See also:

Introduction to the SFDMU Add-On API Engine

The RecordsTransform Core Add-On module

Full export.json format

Last updated on Sa Oct 2022