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.
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.
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.