Date Variable on catalog items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2026 01:56 AM
I have a requirement to configure a date variable on a catalog item so that users can only select dates that are at least 10 business days out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2026 06:22 AM
Hi @KaralapatiN
Try like
(function executeRule(current, previous /*null when async*/) {
var minStartDate = calculateMinStartDate();
if (current.start_date < minStartDate) {
current.setAbortAction(true);
gs.addErrorMessage("Start date must be at least 10 working days from today. The earliest possible date is " + minStartDate);
}
function calculateMinStartDate() {
var today = new GlideDateTime();
var workingDaysToAdd = 10;
var totalDaysToAdd = 0;
while (workingDaysToAdd > 0) {
totalDaysToAdd++;
var tempDate = new GlideDateTime(today);
tempDate.addDays(totalDaysToAdd);
var dayOfWeek = tempDate.getDayOfWeekUTC();
if (dayOfWeek !== 0 && dayOfWeek !== 6) { // 0 = Sunday,
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/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2026 06:34 AM
the requirement is for variable on catalog item but the code you shared is different and looks like a business rule which won't run for catalog item.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2026 06:38 AM
I shared it as a reference to use the logic, not to reuse the same BR.
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/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2026 06:22 AM
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/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
