Validation on Date/Time field for user profile timezone On submission

Mohankumari
Mega Contributor

Hi all,

I have added date/time field in one of my form in service portal.I want to validate on submission of request.( Due to some restrictions I cant use script include and business rule)

 

I have set my user profile timezone to NYT. 

 

When I add value in date/time field (2026-03-20 10:15:00)  and when I click on submit button on service portal at (2026-03-20 10:17:00). It should validate the date/time with current user profile timezone, if it's expired or past date/time.It should block the submission.

 

I tried g_user_date_time_format but it is comparing the value in date/time field with the local time(PC time). 

 

How to troubleshoot this scenario.

 

 

Thanks in Advance!

 

Mohankumari 

9 REPLIES 9

Here is my case, I applied Ui policy, so when I enter the past date/time(e.g. 2026-03-21 10:00:00) , it would clear the field and show error message, but when I enter the future date/time(e.g. 2026-03-21 10:10:00), it would pass the validation.

Later when I click on submit button on service portal at (e.g. 2026-03-21 10:15:00), that time its not validating and submission is allowed. 

 

here I want to add validation aswell.

@Mohankumari 

but you already entered a valid date i.e. future date why would that submission be stopped?

whenever you enter the variable UI policy will run and validation will run

what's not working exactly?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

 

Here I want to make one more validation at the  time of submit, if the submit time(e.g. 2026-03-21 10:15:00) is greater than the date/time field (e.g. 2026-03-21 10:10:00), need to stop the submission.

 

 

Please help me me understand, if there is any UI policy to set the conditions to block submit.

 

 

Thanks,

Mohankumari

@Mohankumari 

Sorry didn't get your question

Share some screenshots

Anytime you enter/change the variable the UI policy will run and check against the current time in which you are

what extra you require>

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Mohankumari
Mega Contributor

I tried this approach on g_user_date_time_format.

 

So here what's happening is  I have set my servicenow user profile time zone to NYT and browser timezone is IST.

for the above approach, on the date/time field ,when I click on date on calendar picker , by default it will show NYT time, when I click on submit it is validating if the entered date/time is in IST time(browsers time) and validating against browers time with the user profile time, and also in the RITM and email , date/time created as user profile timezone and convert it to GMT. 

 

so the g_user_date_time_format provide wrong validation on submit in my case.

 

Thanks for your take on this !