- 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-13-2025 12:49 PM
Hi @FotinaG
if it’s a form on portal, then it must be CATALOG client scrip applied on the variable set.
client script (backend/workspace) x catalog client script (portal/employee centre)
also you will need to create two catalog client scripts (!!!): an onChange to display the error message upon populating the field and onSubmit to abort submission if the value is still in the future ignoring the message.
or it can be done with one script but the onSubmit is more important. So perhaps that and field message to inform not to insert future date..
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2025 02:07 PM
@GlideFather Thank you for your reply, yes I do it in catalog client script, thank you for the hint regarding onSubmit, will test it with both script 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2025 07:53 PM
@FotinaG ,
If this helps, please consider marking my answer as helpful/accepted — it motivates me to stay active in the community and also helps others find relevant solutions more easily.
Thank you!
Shashank Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2025 08:17 PM
you should create catalog client script onChange of that date variable.
what did you start and where are you stuck?
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:32 AM
Hello @Ankur Bawiskar,
Thank you, I am trying with Shashank_Jain code, just updated it a little bit, but didnt work, just no behavior in form: