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 Automate
Unanswered

How to stop a loop

(0) ShareShare
ReportReport
Posted on by 14

Hello,

 

I am currently trying to troubleshoot why this flow is constantly looping after sending an approval email. Is there a way to break the cycle. As you can see a terminate has been added at the end, though, this still allows the loop to continue. Any advice is appreciated.

 

 

Loop.pngLoop1.png

Categories:
I have the same question (0)
  • Rhiassuring Profile Picture
    8,692 Moderator on at

    Hi there, 

     

    Your terminate is outside of your loop. It has no effect on the loop.

     

    Your loop looks like it's going through every single output from your Get Items, sending an email with "Options", and then sending another email if the Selected Option is equal to Yes. It's going to do that for every single item, it has no reason to stop. 

    Can we see what your "Get Items" looks like? Are you trying to only retrieve one result?

  • Jetsam Profile Picture
    14 on at

    Unfortunately I cannot put the terminate inside of the condition, thus why it is there now.

  • Jetsam Profile Picture
    14 on at

    As files are moved from different folders, and updated with correct metadata items, we want only make sure that one email sent to the correct people as everything has been migrated. This is why we implemented this particular solution to ask us to send an email out by first asking us, whether the changes are warranted or not.

     

    The send email with options is working perfectly but it keeps looping regardless of choosing yes or no. The ideal would to break the loop once.

     

    When you say "get items" are you referring to "Get files"?

     

    How do you know which values are getting from the section or dynamic link?

     

    Since a lot of metadata we would like pull as much as possible to in order craft a good message.

  • Jetsam Profile Picture
    14 on at

    Screenshot 2022-08-18 163243.png

  • Jetsam Profile Picture
    14 on at

    Here is revised flow with a variable, designed to try to escape from the loop.

     

     

    Flow1.png

     

     

    Flow2.png

  • Rhiassuring Profile Picture
    8,692 Moderator on at

    It looks like your revision is another Apply to Each (3) - and the Apply to Each (4) won't be affected by that. You can't stop an apply to each until it has gone through every item. If you want to stop it with a variable, you'd want to use a Do Until instead. 


    However, I don't think that's your issue here. 

    Please show me the "Get files (properties only)" configuration. What does your Filter Query look like on it? If we can ensure it only brings back 1 file, then, there should be no loop at all. If there is no query, we need to build one. If there is a query but it's bringing back multiple items (and that's intended), then, we need to put that data into a table, then put the table into the email - rather than going into an Apply to Each.

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 1,027

#2
Valantis Profile Picture

Valantis 809

#3
Haque Profile Picture

Haque 645

Last 30 days Overall leaderboard