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 Automate / Do Until Loop Where Ma...
Power Automate
Answered

Do Until Loop Where Manager = a certain person

(0) ShareShare
ReportReport
Posted on by 30

Hello! 

 

I need help figuring out how to build a flow that takes a people picker name in SharePoint and sends an email to their manager and continues up the chain of managers until it reaches a specific person. 

 

The flow should stop after it reaches that final manager and sends them an email (but not go any higher in hierarchy) 

 

I've tried a few different approaches but always end up getting stuck in some sort of endless loop or it's only pulling the first manager and doesn't keep going.

 

Anybody do something similar to this before? Hoping to get some help.

 

Categories:
I have the same question (0)
  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @drewdev how would you determine when to stop in the chain? So who is the last manager?

  • Verified answer
    AWorley Profile Picture
    414 Super User 2024 Season 1 on at

    Hi, 

    In order to iterate managers through a ladder you will also have to include the "get manager" action and loop across a user profile that is overwriting a variable. The "starting Email" variable is the email address of who ever would kick this off. Can be dynamic or statically typed. 

     

    The flow works as shown here: 

    Do until display name of Manager is equal to the displayname of the final manager. 

     

    Initialize variable Email with Test@test.com > Get the user profile > Get their manager > Set the manager's mail as the User profile > Repeat until the Displayname is equal to the final manager. (can do email address too). 

     

    AWorley_0-1661973970099.png

     

     

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @drewdev 

    Can you post a screen shot of your Flow?  With that, it will be much easier to assist.

  • Andrew5715 Profile Picture
    30 on at

    drewdev_0-1662039416402.png

    drewdev_2-1662039497744.png

     

    This was my latest attempt after finding a process similar listed on the forums

  • Andrew5715 Profile Picture
    30 on at

    Awesome let me try and give this a shot 

  • Andrew5715 Profile Picture
    30 on at

    each person submitting will eventually report up to a certain manager level. so I have the final manager's email that can be used to loop until. So the idea is the flow keeps emailing each manager, gets to the final manager - sends one final email and then stops.

  • Andrew5715 Profile Picture
    30 on at

    I have mine setup similar to yours, but I'm noticing that it keeps looping even though my variable is = to the final manager's email. 

    So it seems like the DO until piece is not being triggered no matter how I write it.. Using Contains or Equal to

     

    drewdev_0-1662484674847.png

     

  • Andrew5715 Profile Picture
    30 on at

    This is the newest iteration that works and loops.. but endlessly even though the variable equals the correct final manager email. Not sure why it's not stopping like I would expect it to

    drewdev_1-1662484721736.png

     

  • AWorley Profile Picture
    414 Super User 2024 Season 1 on at

    Hello,

    I relooked into it and came up with a solution to the end stop. 

     

    1. Initalize a variable and set the final manager as that value. 

    2. Set the Do Until statement to "Get User Profile " IS EQUAL TO" varFinalEmail".

     

    AWorley_0-1662490880484.png

     

     

     

    This exited the loop for me. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard