Date Validation

Nafisa Zaman
Tera Contributor

Hello All,

 My concern about Date filed should validate for today date and time should not be before now time.

 

2 REPLIES 2

Robbie
Kilo Patron
Kilo Patron

Hi @Nafisa Zaman,

 

Date validation is very easily achieved with the use of a UI policy where you can check that the date is for example, not in the future, past (or you have the flexible to configure this control as well - for example no greater than 5 days in the future).

 

Please see this post which show's how to implement this below.

The one thing you will adapt is the period in the condition check - in my example we're checking that the date is at least 24hours in the future, but you easily change this for your needs.

Please holler if you need help or have questions.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

 

https://www.servicenow.com/community/developer-forum/date-variable-cannot-accept-past-date-and-needs...

Chetna_dev
Kilo Sage

For this you can use Client script or UI Policy, if the selected date is today and the time is earlier than the current time, it shows an error message and prevents submission on further actions.

Accept as solution if you find it helpful!

best 

Chetna