- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2025 11:48 AM
Hi Team,
In var set I have Date time field , however i need to make it unpossible to choose date in future and show an info that date cannot be in future in 2 languages depending on what user session is.
I tried with Client script into car set and separately in item, also with UI policy, but still behavior is not changing. It had to be easy task, but I cant achieve the goal. Is it an issue that this variable is in var set?
Could you please help me to find an easy solution?
Thank you
Tina
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2025 01:06 AM
@FotinaG ,
CC : @GlideFather
It should work, if you write client script on variable set too.
Refer below screenshots.
Shashank Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2025 01:50 AM
you can achieve this without scripting and simply use UI policy
Restrict user for selecting future dates in Service Catalogue.
Reference from above: You can write a simple UI Policy as show below:
Output will be as shown below:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2025 12:38 AM
@FotinaG ,
This code is working for me!
Have you selected the right field in client script ?
Can you explain more about where exactly you using this script and for what purpose?
What the issue coming?
Thank you!
Shashank Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2025 12:45 AM
Hello @Shashank_Jain , as i understood i have to write my variable in the end of the code?
Yes, i have chosen that catalog client script is onChange and works for my date/time variable and the this code below. I feel I am missing something but not sure what.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2025 12:51 AM - edited 08-14-2025 12:54 AM
@FotinaG , Where you applying client script on catalog or on variable set?
If on catalog, select the field name correctly, it will show like variable_set name >> field on client script.
If on variable set , simply select the right field on client script.
Shashank Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2025 12:53 AM
Variable set where my variable Dtae/time is in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2025 12:45 AM - edited 08-14-2025 12:46 AM
@FotinaG , Update this last line and try : g_form.setValue("MYVARIABLE", '' ");
Name the date variable correctly.
Shashank Jain