Validate past date and current date using client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 11:10 AM
Hi All,
I am validating the past and current dates using client scripts. Validation for the past date is working fine but if i take the todays date its not working properly. Let me know if any changes required in my code.
Apart from creating script include and on change client scripts and validating with UI Policies and BR is there other options to validate the current date . Please let me know what are the changes to be done in my code to get the expected result.
Note : I am new to service now and learning the scripting part
Code :

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 11:13 AM - edited 07-07-2023 11:14 AM
Hi there,
If it's a date/time field, you could also consider using a UI Policy instead of Client Script.
- 2019-08-12 - Article - No Code date validations thru (Catalog) UI Policies
Kind regards,
Mark
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-07-2023 11:18 AM
I have already gone through above articles and i am using them for the catalog UI policies . Let me know if any changes has to be done in my code to work as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 11:14 AM
Hi @sushma9,
I would suggest to use the UI policy instead of Client scripts.
You can easily achieve using the UI policies with proper conditions.
Take a look at this article. It will help you.
No Code date validations through (Catalog) UI Policies
Thanks,
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 11:15 AM
That's a nice article 🙂
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field