Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to restrict Date optionality using a UI policy

Cuber
Tera Contributor

Hi all, 

 

First time posting in this forum. I'm creating an SC Catalog Form and using the "Date" variable. I want to limit or restrict the date options to 1 month from "today's date" (date of the submission of the request). Meaning, I don't want a user to be able to select a date more than 1 month ahead as well as any past dates relative to "today's date" or the date the user is submitting the request. 

 

How can I accomplish this without using a script? I don't seem to have the option of using scripts with my current permissions on our platform. 

 

Thank you

13 REPLIES 13

Harish KM
Kilo Patron
Kilo Patron

Hi @Cuber you would need 2 UI policies

1. To check more than 30 days below condition needs to be placed

HarishKM_0-1711680470458.png

HarishKM_1-1711680482167.png

 

2. To put error message if past date is selected

HarishKM_2-1711680523895.pngHarishKM_3-1711680535608.png

 

 

Regards
Harish

Cuber
Tera Contributor

Hi Harish,

 

I'm able to apply the conditions as you displayed in your screenshots, however, when I go to the form, I'm still able to select dates past 1 month. 

 

Also, I don't have the option to add scripts unfortunately. (see screenshot)

 

Please advise. Thank you

Hi @Cuber check whether the UI policy is in default view? if yes click on advanced view. Also u do have admin role ?

Regards
Harish

Cuber
Tera Contributor

Hi @Harish KM I don't have the option for advanced view. I only see Default or sys_popup. I have limited ability on the backend. I'm not sure if you'd consider this "admin" or not. When I load the UI policy, I see the "script" tab for a split second. Once the page is fully loaded, it disappears.