I have one requirement where I need to run scheduled job every 3rd business day (excluding weekend)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 10:20 PM
I want to schedule a job for every 3rd business day starting from Monday. So, if I start on Monday then next will run on Thurs and next on Tuesday. We should not consider weekend while counting 3rd day.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 11:41 PM
I don't think there is a direct option available. You can do it via event registry. Please follow the below steps
1) Create a new Schedule with schedule entry which repeats all week day and All day check box selected. This will be used in the script to calculate business days. If you want to exclude Holidays in future, then you can continue using this schedule.
2) Create an entry in Event Registry. Let's say "third.businessday"
3) Create a New Script action for the newly created Event and add your code.
4) Within the code add the below script at the end to schedule the next iteration:
var currentDate = new GlideDate()
var startDate = new GlideDateTime(currentDate.toString() + " 00:00:00"); // Update this time with exact time when you want to run the job
var dur = new GlideDuration(60 * 60 * 24 * 3 * 1000); // Duration for 3 days
var schedule = new GlideSchedule('<sys_id of your new schedule>'); //put your schedule sys_id here
var endDate = schedule.add(startDate, dur);
gs.eventQueueScheduled('third.businessday', current, '', '', endDate);
4) Now you can trigger the event first time by either adding it in a scheduled job and run it once on a specific time or execute it from background script:
gs.eventQueue('third.businessday',current, '', '');
Palani