Trying to run a Scheduled Job every Monday, Tuesday, Thursday and Friday

prudhvig
Tera Expert

Hi,

I have to run a Scheduled Job every Monday, Tuesday, Thursday and Friday. Could someone please let me know how to do this? I am able to run it on a particular day every week. but, this is for 4 days every week. Please let me know.

Thanks in advance.

1 ACCEPTED SOLUTION

Gowrisankar Sat
Tera Guru

Hi Prudhvi,



Run the below code:



Run: on Demand


Conditional: True


Condition:



function excludeWednesday() {


var now = new Date();


var day = now.getDay();


var result = false;


if(day != 0 && day != 3 && day != 6) {


result = true;


}


return result;


}


excludeWednesday();


View solution in original post

3 REPLIES 3

Kannan Nadar
Tera Guru

In your condition field you can check what day it is using script. Check the getDayOfWeek method in the below link



http://wiki.servicenow.com/index.php?title=GlideDateTime#getDayOfWeek.28.29&gsc.tab=0



Thanks,


Kannan


Gowrisankar Sat
Tera Guru

Hi Prudhvi,



Run the below code:



Run: on Demand


Conditional: True


Condition:



function excludeWednesday() {


var now = new Date();


var day = now.getDay();


var result = false;


if(day != 0 && day != 3 && day != 6) {


result = true;


}


return result;


}


excludeWednesday();


Hi Gowrisankar,



Could u please help me out with this? Trying to run a scheduled job at particular times



Thanks in advance.