Minor Normal change request/ Major normal change
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 04:40 AM
My Requirement is Normal - Minor (as below) = 1 working day
if i select the 2 days , i want the error message, but this code not working.
var updated_date,
planned_date,
days;
updated_date = new GlideDateTime(current.sys_updated_on);
planned_date = new GlideDateTime(current.start_date);
days = parseInt(gs.getProperty('informa.change.minor.lead_time', '1'), 10);
updated_date.addDaysLocalTime(days);
if (updated_date.compareTo(planned_date) != 1) {
return;
}
current.setAbortAction(true);
current.state = previous.state;
gs.addErrorMessage(
gs.getMessage(
'Minor Change Requests have to be scheduled a minimum of {0} days into the future',
[days]
)
);
})(current, previous);
2. Major Normal change - Normal - Major = Five working days and to be created before a CAB agenda is issued
var updated_date,
planned_date,
days;
updated_date = new GlideDateTime(current.sys_updated_on);
planned_date = new GlideDateTime(current.start_date);
days = parseInt(gs.getProperty('informa.change.major.lead_time', '5'), 10);
updated_date.addDaysLocalTime(days);
if (updated_date.compareTo(planned_date) != 1) {
return;
}
current.setAbortAction(true);
current.state = previous.state;
gs.addErrorMessage(
gs.getMessage(
'Major Change Requests have to be scheduled a minimum of {0} days into the future',
[days]
)
)
})(current, previous);
Kindly help on this
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 04:43 AM
Hi @keerthana10
I think better you keep a lead time concept and then compare with date of creation and plan start date.
https://www.servicenow.com/community/itsm-articles/change-management-lead-times/ta-p/2299624
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************