cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Does the workflow know what day it is?

Jump to solution

:-)

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?

Reply
8 Replies
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

Hey - what is your call web service doing?

https://community.nintex.com/docs/DOC-6261-february-2017-mission-real-world-solution

In the above document response for the February mission I use the date formatting to work out the current day and then use a switch to respond accordingly.  not quite the same scenario but could you look at the day of the week and do something like that?

Reply
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

 haha also just seen your profile picture - love it! 

Reply
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

In your scenario the Call Web Service isn't going to know if it's a weekday or weekend.  You would need to have some logic within the workflow to tell it that (like the example that  linked to).  However, you can schedule a site workflow to run on workdays only.  So another option is you could build 2 site workflows.  One that kicks of the review process for those tasks set to be reviewed every day, and a 2nd one that you schedule to run only on weekdays and it would only kick off the review process for the weekday only tasks.  You would need to configure your query so that it only returns those tasks require a review every day or only on weekdays depending on the workflow.   

Reply
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

Thanks!

Reply
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

Thank you Brendan, I am going to try implementing a second site workflow. The tasks are basically flagged with a review frequency of "Daily - Weekdays Only", so this should be easy to implement. I will circle back when I have it developed.

Reply
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

That is a nice solution and it works very well. Thank you, Brendan!

Reply
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

Hi, Cassy!

I am going to implement your logic in a different workflow for the same process. When a task is added to the list for the first time, I have a workflow called "Initial Notification" that runs and basically does what the site workflow does. Because this workflow has to start or schedule a workflow based on the review frequency as soon as the task is created, I am going to need some logic. Thank you so much for sharing your Real World Solution! I will report back with how it works.

Reply
Workflow Hero

Re: Does the workflow know what day it is?

Jump to solution

Glad to hear it.

Reply