Past date limitation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 01:49 AM
I have a date variable on a catalog item form. User will manually select the date.
I have to set limitation on past date.
Can anyone please help me out.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 02:13 AM
Hi there,
Is it a date field or a date/time field? That is an essential question for using a no-code approach.
If going for no code, here's an article I wrote in 2019, still valid:
- 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
03-29-2024 02:18 AM
Thanks for your reply. It is a date field.
I have tried with clear value, but the issue is:
If I am raising a request using today's date it is working fine for today but tomorrow it will clear the date field value which was set as today's date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 02:33 AM
Hi @abhisek
Have you added the script in false part as well for - If I am raising a request using today's date it is working fine for today but tomorrow it will clear the date field value which was set as today's date.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 02:39 AM - edited 03-29-2024 02:40 AM
Hi @abhisek ,
You can simple create a UI policy with condition as
<Your date field > is before <today>
and in advance UI policy script if condition enter the below script.
g_form.clearValue(<your date field>);
g_form.addInfoMessage(' past day selection not allowed...');
I hope this helps..
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 03:15 AM
Hi @abhisek ,
Please try below UI Policy , I had worked on a similar requirement previously , instead of at or before you can use before:
Please mark helpful/correct if my response helped you.
