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
Hi Eric,
I think it's it's because the switch control is missing from your flow..
I left the limits at default of:
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?
--------------------------------------------------------------------------
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
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)
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.
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.
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
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
WarrenBelz
146,631
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,991
Most Valuable Professional