past date should not get selected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 03:00 AM
Hi Team,
I have variable (Date/Time) if the user select the past date it should not get selected, only present and future date can be selected

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 03:11 AM - edited 07-28-2023 03:12 AM
Hi there,
Its not possible to prevent one clicking a past date (or make it readonly or something), though you can add validations.
This might help you regarding validations:
- 2019-08-12 - Article - No Code date validations thru (Catalog) UI Policies
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 03:12 AM
Hi @Rajesh77,
You need to write Catalog UI policy with condtions:
Date_time_variable BEFORE Today
Execute if true:
function onCondition() {
g_form.clearValue("Date_time_variable");
g_form.showFieldMsg("Date_time_variable", "Past date not allowed" , "error");
}
Execute if false:
function onCondition() {
g_form.hideFieldMsg();
}
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2023 10:21 AM
Hi @Rajesh77,
Have you look into it? Let me know if you stuck and need any help.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar