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

  • Data Source: If using CSV files as the data source, all Object Sets by default use the same source CSV files located in the working directory.
  • Separate CSV Files: If useSeparatedCSVFiles is set to true, different CSV source files must be provided for each Object Set:
    • For Object Set #1 or objects from 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, e.g., [working directory]/objectset_source/object-set-2, [working directory]/objectset_source/object-set-3, etc.

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

Last updated on 23rd Apr 2024