Condition operators for hierarchical data are great for getting hierarchical data using FetchXML like (above, under, eq-or-under, etc.….), you can find the full list of the operator here:
Example: These operators can be used to get all user’s managers to know the eligible user which has to approve a certain discount (Discount Authority Matrix).
FetchXML will be like this:
<fetch distinct="false" no-lock="false" mapping="logical" >
<entity name="systemuser" >
<attribute name="fullname" />
<filter type="and" >
<condition attribute="systemuserid" operator="above" value="{00000000-0000-0000-0000-000000000000}" />
</filter>
</entity>
</fetch>
The result will be:
<resultset morerecords="0">
<result>
<fullname>Sales Supervisor</fullname>
</result>
<result>
<fullname>Sales Manager</fullname>
</result>
</resultset>
For more examples kindly refer to this useful topic:
Get all Contacts of All Hierarchical Accounts Using FetchXML and Web API
https://www.nexsoftsys.com/articles/get-all-contacts-of-all-hierarchical-accounts-using-fetchxml-and-web-api.html
Note: You can use aggregate to get the count of child records below the referenced record in the hierarchy.
FetchXML:
<attribute name="systemuserid" rowaggregate="CountChildren" alias="UserChildren" />
Result:
<UserChildren formattedvalue="2">2</UserChildren>
Related articles
Hierarchical Data With SSRS Reports – Recursive FetchXML
https://community.dynamics.com/crm/b/magnetismsolutionscrmblog/posts/crm-2011-retrieve-hierarchical-records-recursive-fetchxml
Execute Multiple Retrieve
Using the ExecuteMultipleRequest Message to Perform Bulk Retrievals from Dynamics 365
https://www.linkedin.com/pulse/using-executemultiplerequest-message-perform-bulk-from-elsherbeny/?trackingId=kBEH9a4ESUmQjA1JHMTm6w%3D%3D
ExecuteMultipleRequest Class
https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.executemultiplerequest?view=dynamics-general-ce-9