Schedule Job - need to trigger only on weekdays
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 08:22 PM
Hi All,
I have a schedule job that needs to be triggered only on weekdays. I've have the calendar chosen as "Mon-Fri 8-5" and Trigger mode "Daily". But the job is triggered everyday including saturday and sunday.
How can I fix this?
Appreciate your inputs.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 08:26 PM
Hello Anagha
Check these threads
How to schedule a scheduled job only on weekdays?
https://www.servicenowguru.com/system-definition/weekdaysonly-scheduled-job/
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 08:28 PM
In Scheduled Jobs please enable the Condition checkbox and paste the below code.
var answer = false;
var now = new GlideDateTime();
if(now.getDayOfWeekUTC() !=6 && now.getDayOfWeekUTC() !=7 ) // this scheduled job will run only on Weekdays
{
answer = true;
}
check this also
https://www.servicenowguru.com/system-definition/weekdaysonly-scheduled-job/
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2024 11:11 AM
This conditional script works, running Washington DC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2024 11:38 AM
Hello @anaghas ,
Could you try this code and let me know if it works or not?
var answer = false;
var now = new GlideDateTime();
if(now.getDayOfWeek() == 0 && now.getDayOfWeek() == 6){
answer = true;
}
Thank you.
If this script will help you please like this.