- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 10:41 PM
Hi,
I have a requirement to write a scheduled job which runs every weekday.
I have developed a catalog item which looks as follows:
When I fill this catalog item, it automatically creates a Request, RITM and Catalog Task.
So now, this catalog item should be ordered automatically every weekday so that it finally creates a Request, RITM and Catalog Task.
I am very new to Servicenow and unable to think of how to solve this. Please help.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 11:33 PM
Run:onDemand
conditional: true
condtition:
function checkWeekdays() {
var now = new Date();
var day = now.getDay();
var result = false;
if(day != 0 && day != 6) {
result = true;
}
return result;
}
checkWeekdays();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 11:31 PM
Click on condition and use below script to check the day so that it will run on weekdays only.
var answer = false;
var now = new GlideDateTime();
if(now.getDayOfWeek() > 0 && now.getDayOfWeek() < 6){
answer = true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 11:33 PM
Run:onDemand
conditional: true
condtition:
function checkWeekdays() {
var now = new Date();
var day = now.getDay();
var result = false;
if(day != 0 && day != 6) {
result = true;
}
return result;
}
checkWeekdays();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2018 08:24 AM
Could this be modified to occur every 90 days?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2018 08:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 12:20 AM
Hi Pridhvi
Select the run as weekly and then you will get the option on which weekday you want to run.No extra script required.
Regards
Harsh