Freeze Periods

sowjanyavikram5
Tera Contributor

As a NOC Engineer, I want an error message to appear when a Change Request's planned start and end dates fall within an active freeze period, so that changes conflicting with freeze windows cannot be created or scheduled.  How to create a freeze periods for any user for every years same timings user cannot create or update the change record once the freeze periods start what is the process and how can we do this in servicenow

2 REPLIES 2

sumityadav8
Kilo Sage

Hi @sowjanyavikram5 

You can create a blackout schedule corresponding to your Freeze period, 

So what happens whenever Planned date and start date will be in black out schedule, you will get Scheduling Conflict , And you can write a script for checking conflict status

// Business Rule: Before Insert/Update on change_request table
(function executeRule(current, previous /*null when async*/) {
    
    // Check if there's a scheduling conflict
    if (current.conflict_status == 'conflict') {
        
        // Check if conflict is due to blackout schedule (freeze period)
        var conflict = new GlideRecord('cmn_schedule_conflict');
        conflict.addQuery('change_request', current.sys_id);
        conflict.addQuery('type', 'blackout'); // Filter for blackout conflicts
        conflict.query();
        
        if (conflict.next()) {
            gs.addErrorMessage('Cannot create/update Change Request: Planned dates conflict with freeze period - ' + conflict.schedule.name);
            current.setAbortAction(true);
        }
    }
    
})(current, previous);

 This will work , Let me know if you want further help 

if my response helps please mark helpful & accept as solution 🙂

 

Warm Regards

Sumit Y

Technical Consultant 

Hi @sowjanyavikram5 

I hope you reviewed my solution,

if it helped then please mark it as helpful & accept Solution or if you need any further help then feel free to reach

Warm Regards

Sumit

Technical Consultant