Planned start date must be after current date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 05:09 AM
I have created a field in Record producer which is planned start time. I have requirement that the planned start date must be after the current date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 05:16 AM
@NikhithaNikki Hi create catalog UI policy and give condition somethinglike below and clear the value in UI policy action
Please mark correct/helpful if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 05:21 AM
I have created date/time field. it should be the validate the time also. Can you please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 05:54 AM
the script I shared should handle this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var selectedDate = new Date(g_form.getValue('start_date'));
var todayDate = new Date(); // Now
if (selectedDate.getTime() < todayDate.getTime()) {
g_form.showFieldMsg('start_date', 'Planned start date must be after current date.', 'error');
g_form.clearValue('start_date');
}
}
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
‎05-20-2025 05:25 AM
you can use onChange catalog client script on start date variable
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var selectedDate = new Date(g_form.getValue('start_date'));
var todayDate = new Date(); // Now
if (selectedDate.getTime() < todayDate.getTime()) {
g_form.showFieldMsg('start_date', 'Planned start date must be after current date.', 'error');
g_form.clearValue('start_date');
}
}
You can also achieve this Using Catalog UI policy with no scripting
No Code date validations through (Catalog) UI Policies
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