How to create validation for the below mentioned field it should accept only time(8:00AM to 05:00PM)

kranthi2
Tera Expert

Hi,

How to create validation for the below mentioned field it should accept only time(8:00AM to 05:00PM)

 

I have a Create incident Record producer which consists of field:

Opening and closure time on Monday (sample add 8:00 AM to 16:00 PM) if the same format will not going to enter the user it will show some error message.

 

kranthi2_0-1707450371867.png

 

 

Please help me out how it is possible.

 

 

 

 

5 REPLIES 5

Aman Kumar S
Kilo Patron

If this is the only permitted value, why don't you hardcode the value and make the field read only, that will save you the effort of adding validation to the field.

Or you can use regex to validate the field value

You can follow below servicenow blog to achieve the same, just have to generate regex for the time format that you have.

https://www.servicenow.com/community/in-other-news/validating-service-catalog-variables-following-th...

 

 

Best Regards
Aman Kumar

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @kranthi2 

 

Try this way

 

LearnNGrowAtul_0-1707478150046.png

 

and in script section add the alert.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG 

Thanks for your response, here in my case i want to put any kind of date validation.

 

Thanks

Hi @kranthi2 

 

You can use Trend operator and choose the validation part here

 

LearnNGrowAtul_0-1707579519812.png

 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************