Prevent submitting catalog form with catalog ui policy

florian29
Tera Contributor

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?

 

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

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 🙂

Best Regards
Aman Kumar

View solution in original post

3 REPLIES 3

Chandu Telu
Tera Guru
Tera Guru

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,

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Keep field mandatory and add below in UI policy code part

find_real_file.png

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Aman Kumar S
Kilo Patron

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 🙂

Best Regards
Aman Kumar