- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 06:51 AM
Hi Team,
I have a requirement.
In our company, we have a blackout period for every quarter that lasts 15 days.
eg., March 16th to March 31st
June 16th to 30th
September 16th to 30th
December 16th to 31st
Requirement:
1. Restrict users from submitting the standard change request during the blackout period.
2. Submit only emergency change requests.
Kindly help me on the same.
Thanks,
Anil
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 07:18 AM
did you configure the blackout schedule?
Create blackout and maintenance schedules in Change Management
OR
you can use custom before insert business rule and stop the record insertion, something like this but please enhance
(function executeRule(current, previous /*null when async*/) {
// Only apply to Standard Change Requests
if (current.type != 'standard') {
return;
}
var now = new GlideDateTime();
var year = now.getYearUTC();
// Define blackout periods for the current year
var blackoutPeriods = [
{start: year + '-03-16', end: year + '-03-31'},
{start: year + '-06-16', end: year + '-06-30'},
{start: year + '-09-16', end: year + '-09-30'},
{start: year + '-12-16', end: year + '-12-31'}
];
var today = now.getDate().getByFormat('yyyy-MM-dd');
for (var i = 0; i < blackoutPeriods.length; i++) {
if (today >= blackoutPeriods[i].start && today <= blackoutPeriods[i].end) {
gs.addErrorMessage('Standard change requests cannot be submitted during the blackout period (' +
blackoutPeriods[i].start + ' to ' + blackoutPeriods[i].end + ').');
current.setAbortAction(true);
break;
}
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 07:17 AM
Hi @AnilM99,
Review the "blackout and maintenance schedules in Change Management". See:
change-management/task/t_CreateBlkoutMaintSched.html
Good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 07:18 AM
did you configure the blackout schedule?
Create blackout and maintenance schedules in Change Management
OR
you can use custom before insert business rule and stop the record insertion, something like this but please enhance
(function executeRule(current, previous /*null when async*/) {
// Only apply to Standard Change Requests
if (current.type != 'standard') {
return;
}
var now = new GlideDateTime();
var year = now.getYearUTC();
// Define blackout periods for the current year
var blackoutPeriods = [
{start: year + '-03-16', end: year + '-03-31'},
{start: year + '-06-16', end: year + '-06-30'},
{start: year + '-09-16', end: year + '-09-30'},
{start: year + '-12-16', end: year + '-12-31'}
];
var today = now.getDate().getByFormat('yyyy-MM-dd');
for (var i = 0; i < blackoutPeriods.length; i++) {
if (today >= blackoutPeriods[i].start && today <= blackoutPeriods[i].end) {
gs.addErrorMessage('Standard change requests cannot be submitted during the blackout period (' +
blackoutPeriods[i].start + ' to ' + blackoutPeriods[i].end + ').');
current.setAbortAction(true);
break;
}
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader