- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2025 01:15 AM
Hi All,
I need to modify an existing schedule job for email notifications to run only on weekdays but without a code change on production. And would business calendar help in achieving this in any way? Please see the attached screenshot.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2025 01:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2025 03:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2025 01:43 AM
Hello @ShubhankarK9612 ,
There's no real way for you to schedule this script on weekdays without changing the code. You need to add the condition by clicking the conditional checkbox.
You can add a below script -
(function() {
var gdt = new GlideDateTime();
// Get the day of the week (1=Monday, 7=Sunday)
var day = gdt.getDayOfWeekLocalTime();
// Check if today is Saturday (6) or Sunday (7)
if (day == 6 || day == 7) {
return false; // Do not run the job on weekends
} else {
return true; // Run the job on weekdays
}
})();If the script returns true, the job will run , if false the rob will not execute.
If my response has helped you, kindly mark it as helpful and accept the solution.
Regards,
Nayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2025 01:59 AM - edited 12-26-2025 01:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2025 02:00 AM
If you are on Zurich then you can do this with simple config
Zurich's new run types for scheduled jobs
If not on Zurich then you need to add script in condition field of your scheduled job
answer = checkCondition();
function checkCondition() {
var gdt = new GlideDateTime();
var dayOfWeek = gdt.getDayOfWeekLocalTime();
// day is not saturday and not sunday
if (dayOfWeek != 6 && dayOfWeek != 7)
return true;
else
return false;
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2025 03:27 AM
Thank you for the response