- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 11:46 PM
1.We need to validate date field value should be in 12 months range from current date.
2.In our ServiceNow instance we have different date formats for few users.
3.Our date validation script is working fine for the users preference date format is YYYY-MM-DD .for other users who are having different date format for example yyyy/mm/dd or dd-mm-yyyy ,script getting failed.
4.Could you please suggest is there any global functionality is there to set date format in YYYY-MM-DD irrespective of user preference date format .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 12:10 AM
you should use UI policy so that date format is taken care of and you need not worry on it.
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
08-05-2025 05:27 AM
why not? UI policy can be created against any table and table's field.
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
08-04-2025 11:50 PM
please share your code

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 11:53 PM
Hi,
It sounds like you are doing the comparison on the client side, with some form of client script ?
Instead, you can use the input from the user, send it into a script include and evaluate if the users selected date is within 12 months or not.
Ask if you would like me to explain in more detail.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 11:59 PM
Always convert the date to a standard format (e.g., yyyy-MM-dd) in your script, regardless of the user preference.
Try passing date variable to script include and convert to yyyy-MM-dd format and compare.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 12:10 AM
you should use UI policy so that date format is taken care of and you need not worry on it.
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