Hierarchy Support in Dynamics CRM 2015 SDK

By | July 13, 2015

Introduction

Hierarchies were introduced in Dynamics CRM 2015.  Hierarchy provided a way for visualizing relation between records and identify where the records reside in parent child relationship.

As in example below shows where “Test Account02” situated in hierarchy tree.

Hierarchy_Support

SDK Support

To support the ability to retrieve records based on Hierarchy, the SDK was enhanced and new operators added that would allow you to specify the records to be selected in the hierarchy.

There are new conditional operators has been added in CRM SDK to utilize record hierarchy feature and retrieve records in hierarchy.

Listed below are the conditional operator can be used to retrieve records in hierarchy. We retrieved the records on account form load for account “Test Account02” and displayed in alert dialog to check the result. Below are the condition operator and its description.

1. above

Operator Scope: Can be used as conditional operator for the entity record.

Description: This retrieves records which are above the records in tree. In case of “Test Account02” it is “Test Account01” as below.

Hierarchy_Support1

Note : When records is retrieved with same operator for  account “Test Account05”.This will retrieve account “Test Acccount01” and “TestAccount02”.Accounts ”Test Account04” and  “Test Account03” are not part of the result.

2. eq-or-above

Operator Scope: Can be used as conditional operator for the entity record.

Description: This includes records above the specified record including record itself. In case of “Test Account 02” the result is as below.

Hierarchy_Support2

 3. under

Operator Scope: Can be used as conditional operator for the entity record.

Description: This operator used to retrieve records below the specified record in hierarchical tree. For “Test Account02” the result is as below.

Hierarchy_Support3

For the record “Test Account01” the result records are “Test Account02”,”Test Account03” ,”Test Account04” and ”Test Account05”.

 4. eq-or-under

Operator Scope: Can be used as conditional operator for the entity record.

Description: This operator is used to retrieve records below specified record in hieratical tree including the record. For “Test Account02” the result is as below.

Hierarchy_Support4

 5. not-under

Operator Scope: Can be used as conditional operator for the entity record.

Description: This operator used to retrieve records which are not below specified record. Result includes the current record too. This will be usable in combination with other operators. For “Test Account02” the result is as below. This includes all records except “Test Account05”.

Hierarchy_Support56. eq-owneduseroruserhierarchy

Operator Scope: Can be used as conditional operator for the owner field.

Description: This Operator used to retrieve records owned by user and also the records which are not owned by login user but part of hierarchy. We have created new account “test Account08” which is owned by another user. But its parent account is “Test Account03” as below.

Hierarchy_Support6

For “Test Account08” the result is as below.

Hierarchy_Support7

 7. eq-useroruserhierarchyandteams

Operator Scope: Can be used as conditional operator for the owner field.

Description: This Operator used to retrieve records owned by user and records owned by user in hierarchy.

Below is the screen shot shows Position “P1” and “P2” are related.

Hierarchy_Support8

Position “P1” contains first user and position “P2” contains user “John” as below.

Hierarchy_Support9

Hierarchy_Support10

Record “Test Account08” and “Test Account09” are owned By “Jon”. Since both users are related in hierarchy result for “Test Account03” will be as follows.

Hierarchy_Support11

“Test Account08” and “Test Account09” account records are included in the result.

Before you move to the next post, have you seen our new Click2Export Solution? A 1 click solution to export reports to Word/Excel and Pdf. Email us on crm@inogic.com for a trial or if you would like to see a live demo.