- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 05:00 AM
Hi,
I am new to SNOW and finding it very difficult to script the conditions for running Scheduled Jobs.
1. Need a run a scheduled job quarterly
2. Need to run a scheduled job on 15th April every year
3. Need to run a scheduled job on 15th of every 3 months
4. Need to run a scheduled job on 1st Monday of every month
Could someone please help me in this. I have been trying to see the documentation but unable to get this.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 05:29 AM
1) Run quarterly:
Run: Monthly
Day: 1
Conditional: true
condition:
function checkquarterly() {
var now = new Date();
var month = now.getMonth();
var result = false;
if(month == 3 || month == 6 || month == 9 || month == 12) {
result = true;
}
return result;
}
checkquarterly();
2) Run 15th of april:
Run: Monthly
Day: 15
Conditional: true
condition:
function checkaprilmonth() {
var now = new Date();
var month = now.getMonth();
var result = false;
if(month == 4) {
result = true;
}
return result;
}
checkaprilmonth();
3) Run 15th of every three months:
Run: Monthly
Day: 15
Conditional: true
condition:
function checkquarterly() {
var now = new Date();
var month = now.getMonth();
var result = false;
if(month == 3 || month == 6 || month == 9 || month == 12) {
result = true;
}
return result;
}
checkquarterly();
4) 1st monday of every month:
Run: on demand
Conditional: true
condition:
new Date().getDay() == 1 && new Date().getDate() <8

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 05:29 AM
1) Run quarterly:
Run: Monthly
Day: 1
Conditional: true
condition:
function checkquarterly() {
var now = new Date();
var month = now.getMonth();
var result = false;
if(month == 3 || month == 6 || month == 9 || month == 12) {
result = true;
}
return result;
}
checkquarterly();
2) Run 15th of april:
Run: Monthly
Day: 15
Conditional: true
condition:
function checkaprilmonth() {
var now = new Date();
var month = now.getMonth();
var result = false;
if(month == 4) {
result = true;
}
return result;
}
checkaprilmonth();
3) Run 15th of every three months:
Run: Monthly
Day: 15
Conditional: true
condition:
function checkquarterly() {
var now = new Date();
var month = now.getMonth();
var result = false;
if(month == 3 || month == 6 || month == 9 || month == 12) {
result = true;
}
return result;
}
checkquarterly();
4) 1st monday of every month:
Run: on demand
Conditional: true
condition:
new Date().getDay() == 1 && new Date().getDate() <8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 06:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 06:04 AM
Try this:
function checkmonday() {
var now = new Date();
var day = now.getDay();
var dat = now.getDate();
var result = false;
if(day == 1 && date <8) {
result = true;
}
return result;
}
checkmonday();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 06:05 AM
Try this:
function checkmonday() {
var now = new Date();
var day = now.getDay();
var date = now.getDate();
var result = false;
if(day == 1 && date <8) {
result = true;
}
return result;
}
checkmonday();