How to set a discovery schedule to run 2 times a week

John Vo1
Tera Guru

Is it possible to set the discovery schedule to run on a Monday and then again on a Wednesday?

Thanks,

John

1 ACCEPTED SOLUTION

darius_koohmare
ServiceNow Employee
ServiceNow Employee

You can have the script run daily at the time you want it to run.


Then, set the conditional checkbox field to true and in the conditions section define:



  1. (function() {  
  2.   //run on Monday, Wednesday and Fridays  
  3.   var day = new Date().getDay();  
  4.   return (day == 1 || day == 3);  
  5. })();  


This will run the discovery every day, but will only actually execute successfully if it is monday or Wednesday.


View solution in original post

10 REPLIES 10

Hi Darius,

Thanks for help, I have tried same but it's not working. Please let me know where is the mistake.

I'd run this on Thursday and Friday.
(function() {
var day = new Date().getDay();
return (day == 4 || day == 5);
})();

akashfinning_0-1673619814757.png