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

onLoad? onChange? or onSubmit?


EVerytime I add the condition field it would dissappear when I go back to the schedule


You need to set the Conditional true false field to true.


Do we still specifiy a time we want it to run and it will look at that time?


That is correct. Basically what it does is it runs at the selected time, but it will not execute the job unless the condition evaluates to true.


So you need to run it Daily at the time you want it to run.


It will run M, T, W, F but will not actually make the action except on M and W because thats when your condition evaluates to true.