How can we configure discovery schedules with custom run dates


Description

OOB discovery schedules can be configured with selective run options like On Demand, Daily, Weekly, etc..,but how can we configure a schedule to run on a specific days or specific weekdays or any other run dates not available OOB.

Release or Environment

All

Instructions

- Discovery Schedule ( discovery_schedule ) table has a field called "Conditional" which is derived from parent Scheduled Jobs table. This field would enable us to write a script to derive if today is the date for the schedule to run.

- This script should return true or false which would confirm whether a schedule to to run or not to run.

- You can have the script run daily at the time you want it to run and set the conditional checkbox field to true and write the required script to return true or false.


Example Scenario : 

Run the discovery every Monday or Wednesday.

Script : 

(function() {

var day = new Date().getDay();

return (day == 1 || day == 3);

})();