ExportFiles Core Add-On Module.


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

Table of Contents



Minimal ExportFiles 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 Add-On event declaration where this module should be triggered, see the list of supported Add-On events.

We want to trigger it AFTER the Account records were fully processed.

Full ExportFiles 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-%'
maxChunkSize No number To ensure safe uploading of binary data, the ContentVersions are splitted into multiple chunks, each one is limited to maxChunkSize (in Bytes).

➦ Each chunk is then uploaded individually. This parameter defines a maximal size of the chunk.
15000000 20000000
Notes:
  • The Add-On only works with Files linked to the parent object's records, which records were already uploaded to the Target org.

  • Export of Files into CSV file or import them from CSV file are NOT supported.

    • Upsert: will insert the new Files and update those which were changed in the Source org. The files are compared by the defined External ID field.
    • Update: will selectively update the changed Files, but will not transfer the new Files.
    • Insert: will insert all Files regardless whether they do exist or not in the Target.
    • Delete: 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.

    • The Add-On splits high volume of the input Files into smaller chunks to reduce the memory usage.
    • 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.
  • The maxChunkSize parameter does not split ContentVersion binary data. Each File binary is uploaded at once. The meaning of "chunk" is a multiple ContentVersions organized as a bundle, which is sent to the SF server at a single transaction. It is always recommended to avoid uploading large files in order not to run into problems of various system limitations.

Last updated on 29th Jan 2023