The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to validate a date format in service portal?

abhishekmittal
Tera Contributor

How to validate a date format in service portal either from client script or business rule?

Regards,

Abhishek

2 REPLIES 2

Abhishek Raj3
Mega Guru

Hi Abhishek,



i hope this link will help you.


Re: Date Format Validation in the new Service Portal




Thanks,


Abhishek


Jace Benson
Mega Sage

So this came up in a chat I was having this week.

 

To use the g_user_date_format and g_user_date_time_format and getDateFromFormat, you would have to reinclude the JS file that declares these things.

 

To do that goto the widget where you get a failure message and add a new dependency to a new UI script where you copy/paste the code from https://hi.service-now.com/scripts/calendar.js.

 

Then all your old calls ought to wrok as described in other posts.

var reqDate = new Date(getDateFromFormat(newValue, g_user_date_time_format));//returns a date object you can test against for date/time variables/fields
var reqDate = new Date(getDateFromFormat(newValue, g_user_date_format));//returns a date object you can test against for date variables/fields