Multiple object sets.


Table of Contents



Overview

Purpose: This feature is designed to enhance flexibility in operations by allowing the processing of multiple sub-jobs under one main job.

This is especially useful when multiple operations need to be performed on the same sObject, which is not possible using the standard "objects" array as each object can be specified only once.

Example Configuration Using ObjectSets

In the following example, there are two object subsets defined:

  1. First Subset - Deletes all Accounts and Opportunities.
  2. Second Subset - Inserts one Account record.

This configuration demonstrates handling the same Account object in different operations:

{
  "objectSets": [
    {
      "objects": [
        {
          "query": "SELECT Id FROM Account",
          "operation": "DeleteHierarchy"
        },
        {
          "query": "SELECT Id FROM Opportunity",
          "operation": "DeleteHierarchy"
        }
      ]
    },
    {
      "objects": [
        {
          "query": "SELECT Name FROM Account LIMIT 1",
          "operation": "Insert"
        }
      ]
    }
  ]
}

Combined Configuration with Main objects Set

It is possible to use both the main "objects" set and the "objectSets" subset in the same configuration. In such cases, the operations defined in the "objects" set will run before those defined in the "objectSets":

{
  "objects": [
    {
      "query": "SELECT Id FROM Account",
      "operation": "DeleteHierarchy"
    },
    {
      "query": "SELECT Id FROM Opportunity",
      "operation": "DeleteHierarchy"
    }
  ],
  "objectSets": [
    {
      "objects": [
        {
          "query": "SELECT Name FROM Account LIMIT 1",
          "operation": "Insert"
        }
      ]
    }
  ]
}

Key Considerations

  • Use of a Single CSV File as Data Source and Target: When using CSV files as the source or target for the migration job, all Object Sets by default export to or import from the same CSV files located in the working directory.
  • Separate CSV Files: If the useSeparatedCSVFiles setting is enabled (set to true), distinct CSV source files must be provided for each Object Set during the data import:
    • For Object Set #1 or objects specified in the root "objects" array of the script, files should be placed in the working directory.
    • For subsequent Object Sets, files must be placed in respective sub-directories, for example, [working directory]/objectset_source/object-set-2, [working directory]/objectset_source/object-set-3, etc.
    • Similarly, during data export to CSV files, if useSeparatedCSVFiles is true, the Plugin will export data to objectset_source/... subdirectories instead of overwriting the target CSV files in the root directory for each object set.

For more detailed configuration options, refer to the Export.json File Specification.

Last updated on 29th Apr 2024