web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Show Top record in Hie...
Power Apps
Unanswered

Show Top record in Hierarchy (Model-Driven App)

(0) ShareShare
ReportReport
Posted on by 8

Hi folks

 

had a quick poke around but couldnt find an answer related to this exactly, I'm relatively new to the model driven app world so excuse me if its an easy / obvious one. 

 

Anyway I'm trying to create a lookup field that shows what is the top item in a hierarchy. This would be a 'read-only' field that is dynamically updated, not manually. I would also have seperately a lookup for the immediate parent to the current record, but I need to see the very 'top' item of the tree as well as its important in this solution scenario. If the top record were then assigned as the child of another, so the 'new' top level would take its place in this field.

 

In an excel solution before I've created a kind of recursive lookup for such a feature but this seems messy considering the (delightful) hierarchy view capability of PowerApps.

 

Many Thanks!

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @RKWC 
    PowerApps is not really built to do recursive operations.  I can only see this working with a flat-data structure

     

    With table of all the 'levels' like this you could perform a LOOKUP function on Level3 to return the 1st result from Level1.

     

    Level1 Level2 Level3
    A C F
    A C G
    A D H
    B E I
    B E J

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • RKWC Profile Picture
    8 on at

    Hi, thank you for your response

     

    Apologies if I'm being a bit dense but this is on a model-driven app, how would I implement a LOOKUP function in this way?

     

    If I had a seperate "level" field for each record I don't see how it could be dynamic without some pretty hefty flow operations.

     

    If the UI can show me in one click which is the top record - surely there's got to be an easier way for a field? 

     

    Thanks 🙂

     

  • mdevaney Profile Picture
    29,993 Moderator on at

    @RKWC 

    Sorry, I don’t know how it differs for model-driven apps.  I suppose my response was more canvas app oriented.

     

    ---

    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • KrishnaV Profile Picture
    5,023 on at

    Hi @RKWC,

     

    Here is a quick way to implement lookup in a model-driven app.
    https://thebaconbytes.com/two-new-lookup-features-for-powerapps-model-driven-and-dynamics-365-ce/

     

    This can also be done by JavaScript  (AddCustomFilter method) available in Dynamics 365. Refer below links-

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/addcustomfilter

    https://www.magnetismsolutions.com/blog/nathaneccles/2013/09/30/crm-2013-javascript-lookup-filtering-using-addcustomfilter

    http://missdynamicscrm.blogspot.com/2014/08/crm-2013-using-addcustomfilter-to-get-filtered-lookup-field-based-on-linked-entity.html

     

    I hope this resolved your issue if you see any challenge/need further help let me know I am always happy to help.

     

    Regards,
    Krishna
    If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

     

  • KrishnaV Profile Picture
    5,023 on at

    Hi @RKWC,

     

    I Just want to followup on this issue, please let me know if you see any further help needed.

     

    If you see any challenge/need further help let me know I am always happy to help.

     

    Regards,
    Krishna
    If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • RKWC Profile Picture
    8 on at

    Hi Krishna

     

    Thank you for following up. I'm going to run through some of these docs and see how it goes, I'm not hugely familiar with Javascript editing of forms but if I can make a lookup filter that just points to the top of the hierarchy tree (like in the Hierarchy GUI) then that would be ideal for this scenario.

     

    I'll update a bit later with the results.

     

    Cheers.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard