how to set up a job condition to exclude holidays?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 06:54 AM
Hello everyone!
I tried this script, but it returns false
var answer = new GlideSchedule("sys_id").isInSchedule(new GlideDateTime());
gs.log(answer);
type exclude
I need the schedule job not to work on holidays
how can i do it?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 08:03 AM
@Marina15 Please try below code.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 08:15 AM
it doesn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2023 07:27 PM - edited 01-01-2023 07:27 PM
@Marina15 I have tried the below updated code in my PDI. Its works perfectly fine. Please try out this.
var sched = new GlideSchedule("<SYS ID OF SCHEDULE HERE>");
var todayDate = new GlideDate()+" 10:00:00";
var date = new GlideDateTime();
date.setDisplayValue(todayDate);
var answer = sched.isInSchedule(date);
gs.info(answer);
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2023 09:07 PM
@Marina15 Did you try this? I have tested it in my PDI, it worked fine. So please try it mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 08:24 AM
@Marina15 You are trying this on global scope or scoped app?
ServiceNow Community Rising Star, Class of 2023