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 

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

Resource Example 

1https://YOUR_INSTANCE.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 

1{
2  "operationMode": "create",
3  "relationshipGraphDefinitionIds": [
4    "06JRG000000001AMA2"
5  ],
6  "rootRecords": [
7    {
8      "recordId": "001xx000003GZ39AAG",
9      "name": "PID8 5-Level Hierarchy"
10    }
11  ],
12  "shouldIncludeAllRootRecords": false,
13  "effectiveFromDate": "2026-07-09",
14  "effectiveToDate": "2027-07-09",
15  "isActive": true
16}

Properties 

NameTypeDescriptionRequired or OptionalAvailable Version
effectiveFromDateStringDate when the generated hierarchies become effective. Don’t specify this parameter when operationMode is update.Optional68.0
effectiveToDateStringDate until which the generated hierarchies remain effective. Don’t specify this parameter when operationMode is update.Optional68.0
hierarchyIdsString[]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
isActiveBooleanIndicates whether the generated hierarchies are active (true) or not (false). The default value is true. Don’t specify this parameter when operationMode is update.Optional68.0
operationModeStringSpecifies 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.Required68.0
relationshipGraphDefinitionIdsString[]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
rootRecordsRoot 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
shouldIncludeAllRootRecordsBooleanIndicates 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.Optional68.0

Response Body for POST 

Flexible Hierarchy Rule-Based Creation Response