Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Retrieve the level for a selected subject within a Case



I have a standard Subject Tree on a Case record with multiple levels (4).  When the user selects an option, I need the ability to identify the level of the selected subject.


I have looked at the entity definition and cannot find this information and also cannot customise the entity.


Does anyone know if this is possible without writing code to look through the record using the Parent ?


I am looking at using Power Automate if possible.


thanks in advance


Advocate I
Advocate I

Hi Paul,


Not sure if you're still looking for a solution to this, I recently found I had a similar requirement.  I needed to identify the top-level subject so I could group Cases by each top-level subject.


I was able to solve the problem by using a Do Until loop inside my Power Automate Flow.


The steps I used were:


1. Get the Subject from the Case record, and store the GUID in a string variable:




2. Then set an integer variable (intisParent) witha default value of 1, and created a do until loop:




Inside the do until loop I get the Subject (again) from the tempSubject variable.  I then have a condition that checks if the Subject has a Parent Subject (ie Check if Parent Subject Value != null).





If this condition is true, then set the tempSubject String variable to be the GUID of the Parent Subject, and then repeat the cycle.


If the condition is false (ie the Subject is at the top-level), then set the integer value to be 0.  This causes the do until loop to exit.


From there, the GUID stored in the tempSubject variable, is the GUID of the top level of the Subject tree.


For your requirement, you could use a seperate integer variable to count the number of loops that were completed to get to the top of the Subject Tree, which would give you the level within the tree for the selected Subject.


Hope this helps you (or anyone else searching for how to resolve).



Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.


New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,454)