- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 10:43 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 12:45 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 10:55 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 10:57 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 12:45 PM
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