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

Run if non business days/hours

Jump to solution

Hello everyone,

I am trying to figure out a way to run a "run if" action is a list item is created during non business days or hours. Our scenario is that we want something forwarded to someone else during after hours. Any help would be appreciated.

Thanks!

William

Labels: (1)
Reply
11 Replies
Workflow Hero

Re: Run if non business days/hours

Jump to solution

Hi William,

This will definitely be possible. I think you will have to calculate a few things before you get to the Run-if.

1.  Calculate the date of the week. (Sat, Sun, Mon, Tue, Wed, Thu, Fri) (fn-FormatDate(DATEToCalcFrom,'ddd'))

2.  Calculate the time of the day. (This will depend on your business hours, i.e. 8:00 - 17:00 - then you will have to get the current hour, i.e. 15 for 15h00).

3. At this stage I will add a parallel action. In branch 1. I will add a Run-if to test for Sat and Sun.  In branch 2. I will test for Mon - Friday.

Inside the Run-if 1. you can add the assign flexi task to send the email because if it is SAT or SUN then it is after hours and you can send the email to the afterhours person.  In the Run-if 2, I will add a second Run-if to test for the hours - Hours < start hours and Hours > ending hours.  If this test is passed, I will copy the flexi task from branch 1 to this point to then send the email to the after hours support.

This should solve the problem.

Let me know if I need to explain it in more details.

Reply
Workflow Hero

Re: Run if non business days/hours

Jump to solution

Hi Francois,

Thanks so much for the help. I guess I do need a little more explanation on the calculate day of the week and time of the day portions. Sorry, I'm new to Nintex so trying to figure these things out!

Thanks!

William

Reply
Not applicable

Re: Run if non business days/hours

Jump to solution

Hi William,

Does this link help? And there's an in-built functionality for site workflows that will run only during busines days

Reply
Workflow Hero

Re: Run if non business days/hours

Jump to solution

No Problem

A few Steps:

1. Create Variables DayofWeek as String, nrHoursofDay as Number and txtHoursofDay

2. Add Build String Action and add formula fn-FormatDate(startdate,ddd)) and save to DayofWeek - for today this will return 'THU'

3. Add Build String Action and add formula fn-FormatDate(startdate,hh)) and save to txtHourofDay - for now it will return '03' depending on your time settings on the server.

4.Convert the time to number from txthourofday to nrhoursofday.  This will help with the Run if check.

Then you start with the Run if structure as described earlier.

Reply
Workflow Hero

Re: Run if non business days/hours

Jump to solution

In any conditional action, Set a Condition, Run If, Etc., You can use Inline Functions to support your calculations. So using the metadata from the item, I assume it is the Created date, you can use the Inline Function of FormatDate as Francoise demonstrates to get the day of the week. Once you have that, you can determine what actions to do next.

If it is better to not do the condition right away, you can store the day of the week into a variable using the Set Variable action still using the inline functions. Then with that variable, use if one or additional conditions further down the workflow.

Reply
Workflow Hero

Re: Run if non business days/hours

Jump to solution

Hi Francois,

This is working great for the day of the week. But it looks like my "run if" for hour of the day is not working properly. I suspect:

- There is a formatting issue with extracting the 2 digit hour from my date/time variable.

or

- My "run if" conditions are not correct.

I set up my build string/formula and my conversion just as you described. Our business hours are 8AM to 6PM, so my "run if" basically states if the hour is equal to or greater than 18 or if it is less than 8. Any ideas?

1.JPG

3.JPG

4.JPG

2.JPG

Reply
Workflow Hero

Re: Run if non business days/hours

Jump to solution

Thanks for the suggestions, but this particular workflow needs to be running at all times. Unless there is some way to separate the actions of one workflow over two different ones?

Reply
Workflow Hero

Re: Run if non business days/hours

Jump to solution

Thanks for the help. The day of the week if working fine for me thanks to the suggestions. Just having issues with the time of day now.

Reply
Workflow Hero

Re: Run if non business days/hours

Jump to solution

Hi William,

Just add a Log in history event and write the nrTimeofDay variable into the log in history.  Then execute the workflow again.  Once it completed go to the item, click on the droplist, select workflow and look at the value that was created for nrTimeofDay.  It might be that your server is running on the non-military time, i.e. 01 - 12 and then 01 to 12 again with PM at the back.  If this is the case you will have to get the AM or PM as well. Then in this case before running the Run-if on date add another run-if that checks for PM.  If it is PM add a calculation that nrTimeofday = nrTimeofday + 12.

Let me know if this is not the case

Reply