logo

NJP

Say BIG NO to Scripting - For date field validation | Article Series No.4

Import · Dec 29, 2021 · article

★ Subscribe for Daily Email Updates ★

╔═════ ☩ ══♛══ ☩ ═════╗

Short Knowledge Article Series No.4

╚═════ ☩ ══✦══ ☩ ═════╝

Do you want to restrict future date selection ?

Do you want to restrict past date selection ?

Do you want to restrict selecting few days from now ?

etc...

Say 'BIG NO' to Scripting - For date field validation (Client Script)

Do it in the easy way, use UI policy instead of any script.

  • Navigate to UI policy > Click new.
  • Select the desired table as needed and use realtive condition for data field validation, you can refer the below screenshot on how i have limited future date selection. You can use the same relative condition to restrict any date validations (past, future, days, months, weeks etc...)
  • I have used the script section to show field error message or info message on banner, also used the g_from.clearValue(''field,''); to clear the field after the validation.

image

image

< Next Post Previous Post >

▂ ▃ ▄ ▅ ▆ ▇ █ █ ▇ ▆ ▅ ▄ ▃ ▂

Share | Subscribe | Helpful

<<< More Articles >>>

Thanks,

MF Sohail Khilji.

LinkedIn >https://www.linkedin.com/in/mf-sohail-khilji/

Labels:

image

View original source

https://www.servicenow.com/community/developer-articles/say-big-no-to-scripting-for-date-field-validation-article-series/ta-p/2313152