4

I have a workflow that sends out email reminders for items that have a specified due date. If the items are due 30 days out it sends a reminder every Monday. If they're 7 days out or under it sends reminders daily. This part works through looping and pausing for a week or 24 hours depending on the due date. The problem is that the emails send depending on when the items were created and then kick the workflow off, and the requirement is that the emails send before 8:00am. Is there any way to force the emails to send out a specified time of the day? I can pause the workflows until a specified date AND time, but since the date will be dynamic this isnt an option. This is for an SPO O365 environment.

2 Answers 2

2

You don't get workflow scheduling with the ootb workflow engine.

We had a very similar requirement where list items needed to be checked daily to see if they were due/overdue and send notifications as such in O365. It was a workflow previously but didn't work well. We converted it to a console application that is scheduled to run every day.

The console application uses CSOM to do the same thing that the workflow was doing. We made it a bit more dynamic in that email templates are stored in lists so the administrators can change up verbiage as necessary without needing to recode and compile the application.

6
  • Yikes, I was really hoping to avoid going that deep with this. Thanks!
    – Dana K
    Jan 28, 2016 at 16:13
  • Another option is remote event receivers. This method gave us more control over the process. You might be able to do it with the looping options in the 2013 workflows if you don't want to venture down the development route. Jan 28, 2016 at 16:36
  • I was hoping to modify the existing workflow rather than build out anything custom at this point. The looping portions of the existing workflow allow for emails to send out weekly/daily and work great, but since the items are created at various times throughout the day there doesnt seem to be a way to set a "Pause Until" portion to accomodate that (e.g. if an item is created at 1:00pm I could pause for 12 hours, but if the item was created at 9:00pm that would push it past the desired window).
    – Dana K
    Jan 28, 2016 at 17:03
  • Are you able to use retention policies? If so then usually the timer job would run during the night which is when the workflow would fire. As for pausing you could fix that with several if to see if the time is within X then pause for Y hours( Would require at least two if statements)
    – Roland
    Jan 28, 2016 at 23:22
  • Edit to the above comment: meant to say several IF statements
    – Roland
    Jan 28, 2016 at 23:30
0

Just wanted to update with my solution in case anyone comes across this.

I ended up having enough data available in the workflow to perform what I needed, which was to send emails during a specified window. If you needed to send at an exact time you may be able to expand off of this...

I set my initial variable to the time the item was modified, which will update if the item is modified and triggers the workflow at a different time. Return as ISO formatted.

Set Variable:time to Current Item:Modified

Grab the hour as a substring from the first variable:

then Copy from Variable:time, starting at 11 for 2 characters (Output to Variable:Substring)

From this point you can use Variable:Substring as needed. Time is ISO formatted and will be in UTC, so keep your timezone in mind. For my case I needed to send during a specified window, so I needed to compare the value against my window. SharePoint doesnt allow you to compare a string against a number, so I had to do a calculation to turn the string into a number:

then Calculate Variable:Substring plus 0 (Output to Variable:Calculation)

From that point I was able to use Variable:Calculation to compare against the window I needed by running an if greater than and if less than statement. If the variable did not fall into the desired window I sent the workflow through a loop that would pause for an hour and then loop through the process again. Once it hit the desired window it would process the workflow and hit the rest of my pauses I had previously used, so as bad as it may be to loop x amount of items through a workflow every hour, it only needs to be done initially and then if the item itself is modified.

Again, the biggest gotcha is that returning the date/time in ISO formatting returns a UTC date/time, but you can either do the calculation in your head or modify it during the calculation step. I chose the latter so that when I look back on this in a few months Ill remember that portion.

Not perfect, but somewhat functional considering what was available.

Your Answer

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

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