Trying to create a Scheduled job which creates a Request every weekday

prudhvig
Tera Expert

Hi,

I have a requirement to write a scheduled job which runs every weekday.

I have developed a catalog item which looks as follows:

Screenshot (686).png

Screenshot (687).png

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.

1 ACCEPTED SOLUTION

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();


View solution in original post

12 REPLIES 12

Yes, you are correct


Hi

Can we add Requested for, location, and other fields in this script ???

By the above script, we can create RITM but the description and other fields are showing empty.  how can I fill them by script. ?

Thanks

amoba1
Mega Contributor

Hi, this has been really helpful. I just have 1 question, I see that it is possible to create de RITM along with the REQ and set the variables, my question is regarding the fields in the RITM table.

Is it possible to include these as well in the script?

Thanks in advance.