getFlexibleHierarchySummaryRollupDetails(hierarchyId, nodeMeasureType, offset)

Get paginated summary rollup records for a flexible hierarchy and a rollup type.

API Version 

68.0

Requires Chatter 

No

Signature 

public static ConnectApi.FlexibleHierarchySummaryRollupDetailsRepresentation getFlexibleHierarchySummaryRollupDetails(String hierarchyId, String nodeMeasureType, Integer offset)

Parameters 

hierarchyId

Type: String

ID of the flexible hierarchy whose summary rollup records you want to get.

nodeMeasureType

Type: String

Type of rollup to return. The value must match a nodeMeasureType value in the summaryRollupList property of the flexible hierarchy configuration.

offset

Type: Integer

Number of nodes to skip from the root, in breadth-first order, before returning the next page of summary rollup records. The value must be 0 or greater. To get the first page, specify null or 0. To get the next page, specify the nextOffset value from the previous response. The default value is 0.

Return Value 

Type: ConnectApi.FlexibleHierarchySummaryRollupDetailsRepresentation

Example 

1public static void sample_getFlexibleHierarchySummaryRollupDetails() {
2    // Get the hierarchy configuration to retrieve the node measure type.
3    ConnectApi.FlexibleHierarchyConfigRepresentation config =
4        ConnectApi.FlexibleHierarchyConnect.getFlexibleHierarchyConfig(
5            HIERARCHY_ID,
6            'graph'
7        );
8
9    String nodeMeasureType;
10
11    if (config.hierarchyConfiguration.summaryRollupList != null
12        && !config.hierarchyConfiguration.summaryRollupList.isEmpty()) {
13        nodeMeasureType =
14            config.hierarchyConfiguration.summaryRollupList[0].nodeMeasureType;
15    }
16
17    if (String.isBlank(nodeMeasureType)) {
18        System.debug('No summary rollups are configured for this hierarchy.');
19        return;
20    }
21
22    // Get summary rollup details using the retrieved node measure type.
23    ConnectApi.FlexibleHierarchySummaryRollupDetailsRepresentation result =
24        ConnectApi.FlexibleHierarchyConnect.getFlexibleHierarchySummaryRollupDetails(
25            HIERARCHY_ID,
26            nodeMeasureType,
27            0 // Offset
28        );
29
30    System.debug('Metric Name: ' + result.metricName);
31    System.debug('Record Count: ' +
32        (result.records == null ? 0 : result.records.size()));
33    System.debug('Pagination: ' + result.pagination);
34}