Validation of Planned start date and planned end date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 04:30 AM
I have created record producer with the variables planned start date and planned end date of variable type date/time. I have requirement that planned end date should be greater than planned start date. How to achieve this in ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 04:44 AM
Hi @NikhithaNikki ,
Since these are date/time fields, the values pictured aren't equal. I would try the low-code scripted UI Policy approach
Please refer this
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 04:45 AM
you can use onChange catalog client script on planned end date with this logic
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
//Type appropriate comment here, and begin script below
g_form.hideFieldMsg('end_date');
if (g_form.getValue('start_date') != '' && g_form.getValue('end_date')) {
var start = new Date(g_form.getValue('start_date')).getTime();
var end = new Date(g_form.getValue('end_date')).getTime();
if (end < start) {
g_form.showFieldMsg('end_date', 'End date must be after start date.', 'error');
g_form.clearValue('end_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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 05:01 AM
Thank you for marking my response as helpful.
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-21-2025 12:46 AM
Hope you are doing good.
Did my reply answer your question?
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