I'm trying to build a Power Automate flow that will output a list of all every user that reports (both directly and indirectly) to a manager user ID (input). I have tried to use the "Office 365 Users.Get direct reports" action, save the output to an array variable, and then loop through that array with the same "Get direct reports" action to return the next layer of users. When finished, I would append all these lists together for a single complete list of all direct and indirect reports.
My issue is there could be 5+ layers of management in the organization, so I would like the flow to keep digging into each user until the "Get direct reports" returns nothing. There has to be a simpler method than essentially an infinite number of embedded loops!