3

I have created a workflow in SPD as shown below:

SPD Workflow Loop Issue

When an item is created, the Status is set to "Requested", the Reviewer Response is set to Pending and an email is sent to the responsible Reviewer. The Reviewer must then provide either an "Approved" or "Rejected" response, after which, the Status changes to "Reviewed" and moves on to the next stage.

I tried to create an email reminder loop which sends a reminder email to the Reviewer every 24 hours (5 minutes for test purposes) until the response changes from Pending. Once the response is given, the workflow should resume and move to the next step straight away but I can't get this to work! Even when the Response is changed to either Approved or Rejected, the workflow still waits 5 minutes, sends the Reminder email and only then ticks onto the next stage of the workflow.

I'm fairly new to workflows and have managed to stumble through before and get the results I need but this one has beaten me. I feel like I'm so close with this but there's something (no doubt!) very obvious that I'm missing! Can anyone please advise how I get my workflow to continue once the condition is met?? If anyone has any tips on how to better structure my workflow also, I'd really appreciate it.

Thanks in advance!

4
  • Could you specify your SharePoint version? This will greatly help people to answer. And I know a Pause for duration is always at least 5 minutes even though you set it to 1 minute, because it checks each 5 minutes. Don't know if it is the same thing in your case. Jan 18, 2018 at 14:59
  • Hi, its SharePoint Online site and using SPD 2013. Thanks.
    – Danni L
    Jan 19, 2018 at 9:09
  • Thank you for the replies everyone - I haven't had chance to try them out yet as I came into the office this morning to find that the workflow isn't working at all! Assuming it's a server issue so will try your answers next week and will reply back on here hopefully when I find the solution! :)
    – Danni L
    Jan 19, 2018 at 13:42
  • Ok, hopes you find a solution! And I just saw you had the SPO tag... don't know how I missed that! Jan 19, 2018 at 15:01

4 Answers 4

3

You need to have a two parallel operations: One that loops every day, and one that waits for the review to complete. Once the review is completed, set a variable that indicates the parallel branch's CompletionCondition has been met (click the parallel operation, and choose Advanced Properties from the ribbon).

Here's a quick example using a Task list in SP, so the fields may not match yours, but the principle is the same.

SP Workflow with Parallel Operation

SP Workflow Completion Condition

2
  • Thank you so much! This worked perfectly. The only change I made was to put the pause before the "Send Email" step and it works exactly how I needed it to.
    – Danni L
    Jan 24, 2018 at 9:49
  • This was what i needed, perfect answer Chris, thank you so much.. you saved me a lot of hard work
    – kart
    May 7, 2020 at 19:51
1

I suppose you are using SharePoint designer workflow 2013. If I am not wrong can't we use action "Wait for field change", so that your workflow keeps on sending the reminders until the field Review Response is change from pending.

Hope that helps!

1
  • Thank you for this. "Wait for field change" worked when I added the parallel step to pause and send email. Thanks!
    – Danni L
    Jan 24, 2018 at 9:50
0

This might be a silly response, but...have you made sure that your workflow is set to run upon change? If it just starts upon creation...then any changes made won't run.

0

There is a race condition. After checking whether to send the email, you then pause for 24 hours (5 minutes) before sending it. The status may have changed between the time you checked it and the time you send the email.

There's no way to completely avoid this race condition, since the user can accept the item at any time. However, you can avoid it almost always by checking again whether to send the email before sending it. (Or, equivalently, you could simply move the pause above the if, directly in the loop.)

However, there's another issue (which becomes more obvious once you make the above change): Once the item status is set to Pending, the workflow will immediately enter the loop and pause for 24 hours (5 minutes). This happens far faster than the approver can respond.

You can mitigate this by adding a short (say 30 min) pause before entering the loop; however, if the approver does not respond right away, then the workflow is stuck for a minimum of 24 hours; and even if the approver does respond, the workflow is stuck for 30 minutes.

Your best bet is to kick off a separate workflow to handle the email loop, and then wait for the status to change from Pending without pause.


As an aside, it's probably a mistake that the loop condition and if condition are different. If the reviewer response changes from Pending without the item status changing from Requested, then the workflow would get stuck in the loop, without progressing or doing anything.

You're relying on something else to set the item status appropriately (I imagine). You could use the inner condition for both, and then set the item status inside the workflow after the loop finishes; that would keep all of logic that the workflow depends on in one place.

1
  • Thank you for your reply. You were correct about the loop condition and if condition being different. I originally had it set so they were the same but while I was troubleshooting online, saw a post that had them set different hence why I tried it. All working now with loop and if conditions the same. Thanks again!
    – Danni L
    Jan 24, 2018 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.