I would like to have a way to set normal business hours in the Forms Configuration (e.g., Mon - Fri 8am to 5pm). This would be very helpful for Timer Events in Forms. Currently, I can say exclude weekends. However, I have a timer event that is set for 4 hours to then reassign the task to the backup person, which works well unless the task is assigned late in the business day. I would like to have the timer event only trigger if it has been more than 4 hours and it is within normal business hours. What currently occurs is if the task is assigned to the user at 4:30pm, and that person has already logged off for the day, the task roles the other person at 8:30pm before the user has even seen the task.
Discussion
Discussion
I think this is a great idea, and one that should definitely be implemented.
In the meantime, if you want to incorporate this now, here's an idea for how to do it (I have not tested this fully in Forms, so it might need a little tweaking).
- On your form, include a hidden date (with time) field.
- Set the interrupt Timer Catch Event on your user tasks to trigger 0 days after the variable from the hidden datetime field.
- Prior to assigning the user task, run a workflow.
- In the workflow:
- Add a datetime token, maybe named something like %(Deadline) and set it to the current datetime: %(DateTime).
- Use a Date Token Calculator activity and an Assign Token Values activity to add 4 hours to %(Deadline) and update it with the new time.
- Then check the hour of the %(Deadline) token is after 5 PM: %(Deadline#"HH"#) >= 17
- If it is, repeat step 2 - this time adding 15 hours (the time from 5 PM to 8 AM).
- Then check the weekday of the %(Deadline) token: %(Deadline#"dddd"#)
- If it is Saturday, repeat step 2 - this time adding 2 days.
- If it is Sunday, repeat step 2 - this time adding 1 day.
- Use a Set Business Process Variables activity to populate the hidden datetime field on your form process.
- If you are careful to use the same variable name for the hidden datetime field every time, the Workflow should be reusable across multiple Forms processes.
Here's what the workflow would look like (other than the end where I used a Track Tokens activity instead of the Set Business Process Variables activity because I wasn't using this live with Forms):
At the end, it calculated from current datetime of: Friday, February 26, 2021 5:10:56 PM to Monday, March 1, 2021 12:10:56 PM - 4 business hours after my current time.
Technically it ended up being 4 hours and 10 minutes into the next business day, because I'm currently 10 minutes past the end of the current business day. If that is a concern, then prior to adding the 4 hours, we could check if the %(Deadline#"HH"#) >= 17, and if true, change the %(Deadline) token to be 5:00:00 PM on the current day - then it would follow by adding the 4 hours to 5:00:00 PM instead of the current time of 5:10:56 PM - and our final time would have been 12:00:00 PM on 3/1/2021. Same idea if it is before 8 AM %(Deadline#"HH"#) < 8 and then set the Deadline to be 8:00:00 AM on the current day - then it would follow by adding the 4 hours to 8:00:00 AM.
You could take it even further if you have a database of holidays, and check if the date is on a holiday, and add a day - you might need to do that both before and after the weekend check, before the weekend check to account for a Friday holiday, and after the weekend check to account for a Monday holiday.