Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
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

  • Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on at
    Re: How to stop a loop

    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.

  • Jetsam Profile Picture
    14 on at
    Re: How to stop a loop

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

     

     

    Flow1.png

     

     

    Flow2.png

  • Jetsam Profile Picture
    14 on at
    Re: How to stop a loop

    Screenshot 2022-08-18 163243.png

  • Jetsam Profile Picture
    14 on at
    Re: How to stop a loop

    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
    Re: How to stop a loop

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

  • Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on at
    Re: How to stop a loop

    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?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow