I have a requirement for the cat item . where i have a date/time field .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I want to allow users only to select the date .today+3 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You can follow 2 approched
1. Catalog UI policy
or
2. Catalog OnChange Client script
Catalog UI policy:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
so where are you stuck?
what did you try so far?
You can easily achieve this using UI policy
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @pavankumars3585 ,
You can achieve this by onChange client script :
var gdt = new GlideDateTime();
gdt.addDays(3);
var targetDate = gdt.getDate();
if (g_form.getValue('date_field') != targetDate) {
g_form.showFieldMsg('date_field', 'You can only select ' + targetDate, 'error');
}
Also, I have done similar type of requirement where I set the due date field in cat item 3 days after, so you can refer to that also :
https://www.servicenow.com/community/servicenow-studio-forum/regarding-population-of-due-date/m-p/34...
If my response helped mark as helpful and accept the solution.
