Day of week in Process

Hi

I have been struggling to come up with the necessary process logic to cater for moving on to an action only when it is a weekday and during business hours 08:00 to 18:00.

The following is my current process flow, to which I added the Wait for 6 hours Exclusive Gateway, but my formula is not working:  DayOfWeek([#System variable.Current Date#]) != 6 || DayOfWeek([#System variable.Current Date#]) != 7

Some guidance on how to only proceed to sending the emails during business hours would be appreciated.

thanks

Like 0

Like

4 comments

DayOfWeek is a method on DateTime. What you need is to use a DateTime value for the current date that you can use to determine if that date (the current date) is a weekend or not.

To do this, you can use the "Current Date" system variable (you'll see this on the System Variables tab when creating the formula)

Your formula to determine if it is not a weekend would look like this:

[#System variable.Current Date#].DayOfWeek.ToString() != "Saturday" && [#System variable.Current Date#].DayOfWeek.ToString() != "Sunday"

Ryan

Ryan Farley,

Hi Ryan

Many thanks for this. I have applied and will hope come this Saturday no more reminders are sent out. I will use same approach for dealing with out of hours.

thanks again

Mark

Hi, I have a similar process, but this needs to only perform the actions defined during business hours. Therefore, I created a gateway which will add a 2 hour timer and go back to criteria lookup before allowing progress to the action section if the time is past 18:00 or before 08:00. I therefore took the above and added the following:



[#System variable.Current Date#].DayOfWeek.ToString() == "Saturday" || [#System variable.Current Date#].DayOfWeek.ToString() == "Sunday" || ([#System variable.Current Time#].Hour >=18 && [#System variable.Current Time#].Hour <= 8)

 

This is only interested in the current time/day and I thought a parenthesised AND statement would do the job. However, I am finding this is executing the actions out of business hours, when it should not.

 

What is wrong with the Time statement to match out of hours?

Hi Mark,

 

Your process flow will be executed each Saturday or Sunday or between 18:00 and 8:00 due to the logic of the formula. In case you need the flow to be executed during business days and hours please use this formula:

 

 ([#System variable.Current Time#].Hour <=18 && [#System variable.Current Time#].Hour >= 8) && [#System variable.Current Date#].DayOfWeek.ToString() != "Saturday" && [#System variable.Current Date#].DayOfWeek.ToString() != "Sunday"

 

Best regards,

Oscar

Show all comments