The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Verify that duration date is no more than an year from now based on the date of another variable.

ramosp
Kilo Explorer

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.      

10 REPLIES 10

j_martin
Tera Guru

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


Thanks Justin for the information.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Thanks Pradeep. I will look into threads you provided.