How to set the scheduled job to run from Monady to Friday.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 03:19 AM - edited 11-03-2023 03:26 AM
how to set the scheduled job to run from monaday to Friday only weekdays and also other job to run only on weekends SAT and SUN.
Can any one please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 03:28 AM
Hi use in the condition script
answer = checkCondition();
function checkCondition(){
var gdt = new GlideDateTime();
var dayOfWeek = gdt.getDayOfWeekLocalTime();
// Monday is 1 and there onwards
if(dayOfWeek == 1 || dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 4 || dayOfWeek == 5)
return true;
else
return false;
}
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2024 09:22 AM
Hi Piyushsain,
Thank you for providing the conditional script. It worked for me on the scheduled jobs and Flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 03:32 AM - edited 11-03-2023 03:33 AM
Check the conditional field and add following script
var result = true; var gdt = new GlideDateTime(); var day = gdt.getDayOfWeekLocalTime(); //The day of week value from 1 to 7. Monday equals 1, Sunday equals 7. if(day==6||day==7){ result =false;
} result ;