Scoped GlideSchedule - isValid()

Determines if the current schedule is valid. A schedule is valid if it has at least one schedule span.

Table 1. Returns
Type Description
Boolean True if the schedule is valid.
var g = new GlideRecord('cmn_schedule');
g.addQuery('type', 'blackout');
g.query();
if (g.next()) {
   var sched = new GlideSchedule(g.sys_id);
   var d = new GlideDateTime();
   d.setDisplayValue("2007-09-18 12:00:00");
   if (sched.isValid()) 
      gs.info("Is valid");
 
   else
      gs.info("Is not valid");
}

Output: