- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 02:45 AM
Hi all I have created a date field and a Catalog UI Policy which checks if the date is in the past. If yes an error box is displayed, now I would like to also prevent the user from submitting the form as long as the UI policy is still triggering.
I can create an onSubmit script, but I would have to script my condition there from the UI plicy, which I don't necessarily want.
If I add an email regex behind e.g. a string field, then an error message is displayed there as well and I can't submit the form. Can I also add this in my UI policy?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 05:30 AM
I am afraid, it will not work with UI policy, and onSubmit client script is the only way to handle this.
One thing can work, where if your date field is mandatory, and if the date is in the past, you can clear the field value, and that won't allow the user to be able to submit the form.
But, if that's not the case, you have to go with onSubmit client script
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 02:52 AM
Hi
You can write the UI Policy it self
Yes or No code based your requirement add return false
Check the below for more information
https://community.servicenow.com/community?id=community_question&sys_id=d07f3aa9db58dbc01dcaf3231f9619c0
Thanks
Chandu Telu
Please Mark ✅ Correct/helpful, if applicable,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 02:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 05:30 AM
I am afraid, it will not work with UI policy, and onSubmit client script is the only way to handle this.
One thing can work, where if your date field is mandatory, and if the date is in the past, you can clear the field value, and that won't allow the user to be able to submit the form.
But, if that's not the case, you have to go with onSubmit client script
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar