Verify that duration date is no more than an year from now based on the date of another variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2015 10:06 AM
The user is prompted to enter a date that is no more than a year from now. I need to check that the date is valid when it is entered. Is anyone working on something similar or has a script or business rule doing this already. This is on a service catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2015 10:21 AM
I had done something similar to this on a project before. I don't have the code, but basically I had an onChange client script run for the date. When it changed, I passed the date as well as the other variable to a script include using GlideAjax and did my comparison there.
Date/Time comparison has always been a challenge, there never seems to be an easy way to do it. In the Script Include, you can use GlideDateTime objects to do the actual comparison.
GlideDateTime - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2015 11:53 AM
Thanks Justin for the information.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2015 10:23 AM
Hi Pablo,
You may find the below threads helpful.
http://wiki.servicenow.com/index.php?title=Validate_Date_and_Time
https://community.servicenow.com/thread/165393
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2015 11:52 AM
Thanks Pradeep. I will look into threads you provided.