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 / Flow that reaches the ...
Power Automate
Answered

Flow that reaches the 30 day mark- end of life- if not resolved goes into an infinite loop

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I have a state machine approval flow using the switch control nested in the do until loop with the various cases representing the different approvers.

 

I've been finding this strange behaviour where when the flow gets to the end of it's life (30 days) and if the approval process did not complete then the flow seems to go crazy and into an infinite loop where approvers get sent  continuous emails non-stop.

 

I can still cancel the flow run but I want to ask is there a way to prevent this from happening- IE to get the flow to terminate all the unresolved actions?

 

Thanks for you assistance.

 

Regards,

 

Daniel

Categories:
I have the same question (0)
  • eric-cheng Profile Picture
    5,171 on at

    Hi @Anonymous ,

     

    When the 30 day limit is up, the flow should time out.  

     

    Can you post up your flow?  There may be some values/timeouts in your loops which is causing the flow to behave in some strange way after the timeout.

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @eric-cheng ,

     

    Sorry to come back to you only now.

     

    I read your message and decided to do an experiment- I created a test flow and changed it 3 times to test different scenarios to understand this behaviour:

     

    1. First Scenario:

    - The 'Do Until' loop runs until varStatus = Completed.

    - The 'Switch case' has only one Case which equals 'Stage 1' which I enter manually in the flow trigger as 'Stage 1' so that the flow will run into this Case.

    - The 'Wait for an approval' is set to timeout after 10 seconds (PT10S) to mimic the flow timeout after 30 days but accelerate it.

    - I had two compose actions (perhaps I only needed one).

     

    I wanted to see what happens if the 'Wait for an approval' times out  and there is nothing that closes the 'Do Until' loop (such as a set variable- varStatus to Completed).

     

    I ran this flow and it went into a loop sending me emails non-stop as I experienced in my current situation. It seems that it keeps running because the 'Do Until' loop has not be set to 'Completed'.

     

    (In my real flow, there is a 'set variable' action that set's varStatus to the next case 'equals to' value but not to 'Completed' however the loop remains in the case where the flow came to a standstill)

    DanielRK_0-1633684708152.png

     

    2. Second Scenario:

    - I changed the actions under the 'Wait for approval' to have a normal path that the flow follows if all proceeds well but a second parallel path if it times out and goes into the loop.

    - Normal path is the 'Set Variable' action

    - TImeout path is the 'Send an email' to notify of the timeout and 'Set variable' action to close the loop.

     

    This worked. It timed out and I didn't get any further emails.

     

    DanielRK_2-1633686542000.png

     

     

    3. Third scenario:

    - I was concerned that since the 'set variable' action in the normal path does not have a 'configure run after' setting, that it would simply run even if the prior action 'wait for an approval' timed out (which is happening in my real situation as I have a 'set variable' action that immediately follows the 'wait for an approval'. It ran regardless of the outcome of the prior action).

     

    I thought to put a compose action above the variable and set it to run only after success of the 'wait for an approval action' so that if it did timeout, then the flow would stop at that point.

     

    Although the test produced the same result as scenario 2, The result of scenario 2 showed that my concern was unfounded as the parallel path with the 'send an email' action set to run after the 'wait for approval' action ran and the variable in the normal branch did not.

       

    DanielRK_1-1633686360924.png

     

    My final though was whether I needed the 'set variable' action after the email action in scenario 2 above to close the 'Do Until' loop. I tested and indeed it is needed, because without it the flow goes into the infinite loop.

     

    CONCLUSION:

     

    Have a parallel timeout branch under the 'Wait for an approval' action which contains a set variable action to close the loop.

     

    Please let me know your thoughts on this test and whether I have reached the correct conclusions?

     

    Thank you again.

     

    Regards,

     

    Daniel

     

  • eric-cheng Profile Picture
    5,171 on at

    Hi @Anonymous ,

     

     

    I'll do a bit more testing tomorrow morning but strangely, I couldn't replicate your issue with PT10S and leaving it for 1 minute.  Again, could just be my rushed flow.

     

    Also, out of curiosity, did you set a count in your Do Until?

     

    ericcheng_1-1633690837490.png

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Eric,

     

    I think it's it's because the switch control is missing from your flow..

     

    I left the limits at default of:

     

    DanielRK_0-1633691326762.png

     

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 312 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 154 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 143 Super User 2026 Season 2

Last 30 days Overall leaderboard