Flexible Hierarchy Apply Rules (POST)

Create new flexible hierarchies or update existing hierarchies asynchronously by applying the rules defined in a relationship graph definition. Use the operationMode parameter to create hierarchies for matching root records or to re-apply the rules so that existing hierarchies stay in sync with the source data. This API runs asynchronously and returns an ID to track the request.

The operationMode parameter determines the operation. create uses relationshipGraphDefinitionIds (specify an ID) and either rootRecords or shouldIncludeAllRootRecords to build hierarchies for roots that don't already have a hierarchy. Don't specify hierarchyIds when operationMode is create. The update mode uses hierarchyIds to re-run the rules for existing hierarchies. Don't specify relationshipGraphDefinitionIds or rootRecords when operationMode is update.

Resource

/connect/flexible-hierarchies/actions/apply-rules

Resource Example

https://yourInstance.salesforce.com/services/data/v68.0/connect/flexible-hierarchies/actions/apply-rules

Available Version

68.0

HTTP Methods

POST

Request Body for POST

JSON Example

{
  "operationMode": "create",
  "relationshipGraphDefinitionIds": [
    "06JRG000000001AMA2"
  ],
  "rootRecords": [
    {
      "recordId": "001xx000003GZ39AAG",
      "name": "PID8 5-Level Hierarchy"
    }
  ],
  "shouldIncludeAllRootRecords": false,
  "effectiveFromDate": "2026-07-09",
  "effectiveToDate": "2027-07-09",
  "isActive": true
}

Properties

Name Type Description Required or Optional Available Version
effectiveFromDate String Date when the generated hierarchies become effective. Don't specify this parameter when operationMode is update. Optional 68.0
effectiveToDate String Date until which the generated hierarchies remain effective. Don't specify this parameter when operationMode is update. Optional 68.0
hierarchyIds String[] IDs of the existing hierarchies to apply the rule. Required to update the hierarchies. Specify up to 1,000 records to process for the update operation. Don't specify this parameter when operationMode is create. Required if operationMode is update. 68.0
isActive Boolean Indicates whether the generated hierarchies are active (true) or not (false). The default value is true. Don't specify this parameter when operationMode is update. Optional 68.0
operationMode String Specifies whether to create new flexible hierarchies or update existing ones. create creates new flexible hierarchies, and update synchronizes existing hierarchies with the latest source data. Required 68.0
relationshipGraphDefinitionIds String[] ID of the relationship graph definition that defines how the hierarchies are generated. Specify one ID at a time. Don't specify this parameter when operationMode is update. Required if operationMode is create. 68.0
rootRecords Root Record Input[] Root records to create flexible hierarchies for. Specify up to 1,000 root records. Use this parameter when operationMode is create and shouldIncludeAllRootRecords is false or not specified. Don't specify this parameter when operationMode is update. Required if operationMode is create and shouldIncludeAllRootRecords is false or omitted. 68.0
shouldIncludeAllRootRecords Boolean Indicates whether to generate hierarchies for all root records that match the relationship graph definition (true) or not (false). Don't specify this parameter when operationMode is update. Optional 68.0

Response Body for POST