cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
geommm
Advocate IV
Advocate IV

2 parallel loops dont work

Hi all,

I am trying use an approval to manage a loan. The user can choose either to extend the period of the loan or, if the item is returned, to close the loan. On the day of the deadline, an email is sent, every day thereon, as a reminder that the loan is due.

 

To do this I implemented 2 parallel loops. One loop contains the approval and the other waits for the deadline and sends an email every day. When the user approves by selecting "Extend Loan", the return date is extended. When they approve with "Return device", a flag is set to True which is the Loop Until condition of both loops.

 

The outcome is hard to debug, since loops cannot be debuged until they naturally teminate. In this case, the loop with the approval misbehaves and never ends. I have tried to set a 10 minute limit on both loops but this does not cause either to end.

 

For the sake of the test I changed all days into minutes just for debugging.

 

flow parallel loops.png

Strangely, the condition after the approval also does not work. When I select "Extend Loan" the "If no" branch works ok. But if I select "Return Device" in the approval the "if yes" does not appear to run (the email is not sent), however the variable loan_completed=True appears to get set, since the other loop actually terminates on this condition but the loop with the approval does not terminate and I receive another email for approval.

 

I have also tried moving "Do Until 2" in parallel to the create approval but the result is pretty much same.

 

Any ideas? thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

That's why I always enter it as an expression.  Case will make a difference if you match to text.  But the expression is an actual Boolean and always works.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

6 REPLIES 6
Pstork1
Dual Super User
Dual Super User

Is the approval directed to a single person or multiple people? I get the impression its to a single person.  If it is then I would suggest using Outcome instead of Responses.  That way you can avoid the first Apply to Each loop entirely.  for a single approval Outcome will be equal to either one of the individual responses that you've provided.

 

Second, I suggest putting the delay inside your Do Until Loop.  Start the loop, delay, then check whether the loop should be ended or not.  If not send the email reminder. Repeat.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi thanks for your reply

 

The approval is for a single person. The loop is because the approval is not just yes/no but can be used to extend the loan one or more times than finally to complete the procedure by selecting the Returned Device option. It needs a loop otherwise it will not issue an approval at every extension of deadline of the loan.

 

Yes, I initially had the delay inside the 2nd loop then took it out to help me debug. It doesn't make a difference. The 2nd loop terminates when at the right time but the email inside is never set.

The behavior is very wierd like some activities are just skipped entirely.

The problem with the first loop is that you are looping on the response.  If the approval is sent to one person there will never be more than one response.  But that response will be in a collection.  I think you believe that if the response is to extend the loan that the approval will still be live and another response can be sent.  It isn't unless you create and send another approval, which you don't. 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

wow I posted a reply to this. I then edited the reply to correct an image and now the post is gone 😞

And so I discovered what was the main problem.

I was using "True" instead of "true" in my conditions and in my assignments.

I found a post of yours @Pstork1 in which you are recommending to enter true/false as an expression instead of as a string and indeed it worked. The case probably mattered as well.

Thanks

George

 

That's why I always enter it as an expression.  Case will make a difference if you match to text.  But the expression is an actual Boolean and always works.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (5,362)