getFlexibleHierarchyNodeDetails(hierarchyId, nodeId, offset, pageSize, sortField, sortOrder, context)

Get the details of a node in a flexible hierarchy, including its child nodes, ancestor nodes, and the relations between them.

API Version 

68.0

Requires Chatter 

No

Signature 

public static ConnectApi.FlexibleHierarchyNodeDetailsRepresentation getFlexibleHierarchyNodeDetails(String hierarchyId, String nodeId, Integer offset, Integer pageSize, String sortField, String sortOrder, String context)

Parameters 

hierarchyId

Type: String

ID of the flexible hierarchy to get the node details for.

nodeId

Type: String

ID of the flexible hierarchy node to center on. If you specify null, the hierarchy's root node is used.

offset

Type: Integer

Number of child nodes to skip before returning results. The minimum value is 0. The default value is 0. Specify null to use the default value.

pageSize

Type: Integer

Maximum number of child nodes to return on a page. The minimum value is 1. The default value is 20. Specify null to use the default value.

sortField

Type: String

Field to sort the child nodes by. Specify null to use the default value.

sortOrder

Type: String

Order of sorting the child nodes. Valid values are: asc and desc. The default value is asc. Specify null to use the default value.

context

Type: String

Viewer context that determines which fields are returned. Valid values are: graph and grid. The default value is graph. Specify null to use the default value.

Return Value 

Type: ConnectApi.FlexibleHierarchyNodeDetailsRepresentation

Example 

1public static void sample_getFlexibleHierarchyNodeDetails() {
2    // Get root node details (nodeId = null).
3    ConnectApi.FlexibleHierarchyNodeDetailsRepresentation root =
4        ConnectApi.FlexibleHierarchyConnect.getFlexibleHierarchyNodeDetails(
5            HIERARCHY_ID,
6            null,       // Root node
7            0,          // Offset
8            20,         // Page size
9            null,       // Sort field
10            'asc',      // Sort order: asc | desc
11            'graph'     // Context: graph | grid
12        );
13
14    System.debug('Root Context Node: ' + root.contextNode);
15    System.debug('Root Child Node Count: ' +
16        (root.childNodes == null ? 0 : root.childNodes.size()));
17    System.debug('Root Path to Root: ' + root.pathToRoot);
18
19    // Get details for a specific child node.
20    ConnectApi.FlexibleHierarchyNodeDetailsRepresentation child =
21        ConnectApi.FlexibleHierarchyConnect.getFlexibleHierarchyNodeDetails(
22            HIERARCHY_ID,
23            CHILD_NODE_ID,
24            0,
25            20,
26            null,
27            'asc',
28            'graph'
29        );
30
31    System.debug('Child Context Node: ' + child.contextNode);
32    System.debug('Child Path to Root: ' + child.pathToRoot);
33    System.debug('Child Node Count: ' +
34        (child.childNodes == null ? 0 : child.childNodes.size()));
35}