The Now Platform® Washington DC release is live. Watch now!
‎07-06-2017 12:13 AM
How to validate a date format in service portal either from client script or business rule?
Regards,
Abhishek
‎07-06-2017 12:15 AM
Hi Abhishek,
i hope this link will help you.
Re: Date Format Validation in the new Service Portal
Thanks,
Abhishek
‎03-28-2018 08:33 AM
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