24-Hour Schedule

brennamorss-fis
Kilo Contributor

We have a requirement to auto-close HR cases after 3 business days (that have been awaiting acceptance with no updates). I have attempted to achieve this using a script-based Scheduled Job paired with a Schedule. We want to only count business days but count the entire 24-hour period (unlike the system-delivered Schedule 8-5 weekdays which is a 9-hour period). I have created a new schedule that includes weekdays and is set to 'All day'.

When I run my Scheduled Job though, an unexpected behavior is observed:

If my case was updated at 2017-12-20 16:44:36 and my time is 2017-12-21 18:40:16, the duration according to my 24-hour Schedule is 1970-01-01 13:40:16 when I would expect it to show as 1970-01-02 01:55:40. Could someone explain to me why according to my schedule it does not register that 24 hours has passed?

1 ACCEPTED SOLUTION

Not sure on the script and why it isnt working. I offer another route though - and that is using the HRI Case User Acceptance workflow that is provided OOB to close cases in awaiting acceptance. In that workflow update the Timer activity to be 3 days on the schedule you have defined


View solution in original post

3 REPLIES 3

sachin_namjoshi
Kilo Patron
Kilo Patron

Please check below script which allows you to close ticket as per schedule



https://www.servicenowguru.com/scripting/business-rules-scripting/calendar-based-incident-autoclose/



Regards,


Sachin


This is what I was using as my source already. The question is not how to do it but why the schedule is registering the times I presented as less than a 24-hour period.


Not sure on the script and why it isnt working. I offer another route though - and that is using the HRI Case User Acceptance workflow that is provided OOB to close cases in awaiting acceptance. In that workflow update the Timer activity to be 3 days on the schedule you have defined