Have you ever wondered how in some Dynamics 365 apps the capability to have a record hierarchy has been created? Do you want to recreate this type of functionality with your own custom tables? Keep reading to find out how to do this now! 🤩
Hierarchal records
So friends… in Dataverse, we have the capability of creating a relationship between a table and itself! So I can say for a certain property, make a record in the same table a parent of a child record! When we do this we can enable a hierarchal relationship here which also enables a user interface in side of model-driven apps for us that we can use to see the hierarchy of records in the hierarchy configured table, and how they relate to each other in the hierarchy!
Configuring hierarchy
So let’s look at how to do this. I have a table of bookmarks where sometimes I’ll have a parent bookmark of a certain category which I might point to a high level webpage and then I want to have sub bookmarks which store the same data but for sub pages of that high level webpage.
Creating the relationship
In my bookmarks table, I’m going to create a relationship which can be many-to-one or one-to-many. In the related table, I’ll populate the Bookmarks table again…
Now you’ll also notice here I have the option to enable this relationship as ‘hierarchical’. Enable this to enable the hierarchy UI for this table. This is the relationship that will then be used for the hierarchy UI. Make sure you also name the lookup column. You’ll now need to add the lookup column to the bookmarks main form so users can populate the parent bookmark.
Hierarchy settings
Now we’ll need to head into the classic UI to customise hierarchy settings on this table. Navigate to the table in customise the system within the classic UI under advanced settings and locate the table. Then you’ll need to select hierarchy settings and create a new hierarchy setting record.
Give the setting a name and then select the default quick view form.
Finally, save and publish all changes.
Hierarchy in model-driven apps
Now let’s take a look at what hierarchy looks like in model-driven apps when it is configured on a table. I’ve created two records and set one as the parent of the other.
You’ll notice once this is configured we have an icon that now sits to the left of the first field in our view for the relevant table.
I’m going to select the hierarchy icon on one of my bookmarks.
And there we go! I now have a hierarchy view of how my records are organised, and parented! Simples! Let me know in the comments below how you plan to use this in your solutions or which tables/types of data you’d use this with.
Did you like this content? 💖
Did you like this content? Check out some of the other posts on my blog, and if you like those too, be sure to subscribe to get my posts directly in your inbox for free!
Subscribe