AnsweredAssumed Answered

Does the workflow know what day it is?

Question asked by andreapasutti on May 11, 2017
Latest reply on May 16, 2017 by murphybp2


Yes, it sounds silly, but I'm using a call web service action to schedule my workflow only on the weekdays. Here's the scenario:


I have a task list of recurring tasks for everyone in the department. Users can select the review frequency (weekly, monthly, etc.) including "Daily - 7 Days" and "Daily - Weekdays Only". The Site Workflow runs daily at midnight. It calculates the date for Today (the current date at midnight), it calculates the date for Tomorrow (the current date + 24 hours). Then it queries the Task List for tasks that start <= Tomorrow. It either kicks off the List Workflow if the start date of the task is <= Today or else it schedules the workflow.


Because users have the option for tasks to be scheduled every day of the week, the site workflow must run each day. I have my Call Web Service actions configured correctly, 1 for weekdays and one for 7 days. The problem is that if my site workflow runs every day, it performs the date calculations every day, and when it gets to the Call Web Service action for weekdays only, it schedules it and then the workflow starts when it gets to the scheduled time, even on weekends. I think my expectation of how the CWS action works is wrong. I'm expecting it to know whether today is a weekday or weekend and schedule accordingly. It doesn't seem to be doing that. If there is a value in the variable, it will schedule it, regardless of whether it is a weekday or not. And last weekend it skipped Saturday and scheduled on Sunday.


So how can I have one site workflow run every day and know the difference between a weekday and a weekend and schedule accordingly?