- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 04:02 AM
Hi All,
I have a requirement for scheduled jobs to run on the on a certain day on certain months, for example -
Run on 1st of March, June, September and December.
Is there a conditional script to achieve this and to miss out weekends?
Many thanks,
Alex
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 08:47 AM
Set your scheduled job to run Monthly, on the date you need and time. Then in the condition script check for the month to trigger. Example below script triggers on 1 month, 4 month, etc
var result = false;
var gdt = new GlideDateTime();
if (gdt.getMonthLocalTime() == 1 || gdt.getMonthLocalTime() == 4 || gdt.getMonthLocalTime() == 7 || gdt.getMonthLocalTime() == 10) {
result = true;
}
result;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 08:47 AM
Set your scheduled job to run Monthly, on the date you need and time. Then in the condition script check for the month to trigger. Example below script triggers on 1 month, 4 month, etc
var result = false;
var gdt = new GlideDateTime();
if (gdt.getMonthLocalTime() == 1 || gdt.getMonthLocalTime() == 4 || gdt.getMonthLocalTime() == 7 || gdt.getMonthLocalTime() == 10) {
result = true;
}
result;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 09:06 AM
Hi Michael,
Thank you!
I have set this now and will confirm this worked correctly tomorrow, 1st day of 10th month.
Thanks again,
Alex

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 09:10 AM
If I am not mistaken, this will only run on the 1st of the month. If the 1st falls on a weekend, then this should not run on that day, but wait until Monday.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 09:12 AM
Ah yes, nice catch! Alex, this will not exclude weekends, missed that in your original post!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2019 01:41 AM
Hi Michael,
This has worked! I double checked with the team that requested this and skipping weekends was not actually required.
Thanks again!
Alex