- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2016 01:20 PM
I am having issues with my script not always performing as expected. I've tried to determine why it is so inconsistent. Time within the schedule consistently work however It is a rather hit and miss when time is outside of the schedule. I can't quite determine why or what is causing it to fail. Would anyone have any ideas? Below is my script.
if (current.isNewRecord()) {
// Determine if date is within the schedule
var schedID = '<<sys_id of the schedule is entered here>>'; // Business Hours 7-4:30 weekdays excluding holidays
var sched = new GlideSchedule(schedID);
if(!sched.isInSchedule(new GlideDateTime())) {
current.u_after_hours_call = true;
current.u_after_hr_system_checked = true;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 07:43 AM
ServiceNow couldn't find any issue with my script either. They did suggest not to use the sys_id directly in my script but to look up the sys_id by schedule name.
I determined what the issue was. My script was working as it should. I am a bit embarrassed to say that the issue was not all scenarios were accounted for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2016 01:52 PM
Hmm.. you shouldn't need that. It should be working I haven't used "isInSchedule" so much, but the few times it seems to be working, thou you're making me nervous now...
I would put a ticket to HI and see what they say.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2016 01:58 PM
I will place a ticket on the HI and update this when I hear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 07:43 AM
ServiceNow couldn't find any issue with my script either. They did suggest not to use the sys_id directly in my script but to look up the sys_id by schedule name.
I determined what the issue was. My script was working as it should. I am a bit embarrassed to say that the issue was not all scenarios were accounted for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 08:40 AM
Well, the main thing is that you got it working