- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2022 10:08 PM
Hi Team,
How can I schedule a job to run only on the 2nd working day of the month? For example in the month of January of this year, 4th is the second working day, so job should run only on 4th. Only once in a month that too on a second business day.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2022 08:01 AM
Hi Khanna,
To exclude holiday, use Schedule.
- Create a new Schedule (from Navigator, go to System Scheduler > Schedules > Schedules)
I've create a schedule named "Weekdays excluding Holiday".
Add "U.S. Holidays" as a Child Schedule. - Create Schedule Entries to the schedule
- Set Condition on Scheduled Job
Run: Daily
Condition:function checkIfSecondDay() { var grSchedule = new GlideRecord('cmn_schedule'); if (grSchedule.get('name', 'Weekdays excluding Holiday')) { var sched = new GlideSchedule(grSchedule.sys_id); var gdt = new GlideDateTime(); gdt.setValue(gs.beginningOfThisMonth()); var days = 1; var dur = new GlideDuration(60 * 60 * 24 * 1000 * days); var secondDay = sched.add(gdt, dur); var today = new GlideDateTime(); today.setDisplayValue('2022-01-05 12:00:00'); return (today.getDayOfMonthLocalTime() == secondDay.getDayOfMonthLocalTime()); } return false; } checkIfSecondDay();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 12:19 AM
Hi,
Use the below code in condition and try i hope it will work.
var today = new GlideDateTime();
var dayOfWeek = today.getDayOfWeek();
if(dayOfWeek == 2 ){
return true;
}
Mark it helpful || Correct
Thanks and regards
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 12:21 AM
use this scheduled job as periodically.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 12:27 AM
Hi,
You can change the Run field as Monthly and keep the Day as 2.
You can check the conditional checkbox as true and write the below mentioned script.
//Return 'true' to run the job
var answer = false;
//Get the day of week. 1=Monday, 7=Sunday
var now = new GlideDateTime();
//Run only on weekdays
if(now.getDayOfWeek() < 6){
answer = true;
}
answer;
Regards,
Deepankar Mathur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 04:34 AM
The above script runs 4 times every month, suppose we want to run only on the 2nd Business day in the month and only once and not after that?