Configuration items have a Maintenance Schedule field (maintenance_schedule) that allows a Schedule (cmn_schedule) to be referenced that defines the number of times a change can be applied to the configuration item. The maintenance schedule defined in this field is not factored by the current implementation of Change Conflict Detector (Change Collision)
Steps to Reproduce
Verify the setup for this procedure: you have demo data loaded on a fresh instance, anf the Java Application Server FLX configuration item has been defined with the Application FLX schedule.
Configure a configuration item with a maintenance schedule defined in its maintenance_schedule field.
Create a new Change Request, set the configuration item field to the newly created configuration item, and save the record
Set the planned start/end dates to be outside of the maintenance schedule and save.
Conflict detection should execute and set the Conflict status field.
Check the Conflict tab on the Change Reques.t
Note that there is no conflict for the associated CI with a reference to the Application FLX schedule, although one should be created to indicate that the Application FLX schedule is the reason why there is a conflict.
The following script is a guide to implementing this change and does not account for any existing customizations that might have already been applied.
The same sched object is instantiated, but the isValid function is used to validate the provided maintenanceWindow sys_id.
Replace the start of the function:
// Case1: maintenance window is null if (JSUtil.nil(maintenanceWindow)) return true; // Case2: maintenance window is invalid var record = new GlideRecord("cmn_schedule_maintenance"); record.addQuery("sys_id", maintenanceWindow + ""); record.query(); if (!record.next()) return true; // Case3: check maintenance window var sched = new GlideSchedule(maintenanceWindow);
With the following:
var sched = new GlideSchedule(maintenanceWindow); // check maintenance window is valid if (!sched.isValid()) return true;
// check maintenance window
Related Problem: PRB1299045