Stop a catalog item from being submitted if a field is not filled in

Andre8
Giga Guru

On this catalog item I have a field that is greyed out and if the field is empty, a notification pops up at the top of the screen using a Catalog UI policy. However, I would also like to stop the form from being submitted if this field is not populated. I have tried g_for.setMandatory() but this doesnt seem to work:
find_real_file.png
When to Run:
find_real_file.png
Catalog UI Action:
find_real_file.png

Catalog UI Policy Script
find_real_file.png

2 REPLIES 2

dmathur09
Kilo Sage
Kilo Sage

Hi Andre,

Can you make this field mandatory from the catalog UI policy action instead of using g_form.setMandatory. You are making this field read only from UI policy, same way you can make it mandatory as well.

Regards,

Deepankar Mathur

Shahebaz
Giga Guru

Hello Andre,

You have to write OnSubmit client script and check the field is empty or not. If you are using that catalog item on portal then you have to take care of asyncronus calls.

https://community.servicenow.com/community?id=community_article&sys_id=e37f2072db9fd0103daa1ea6689619c6

Please check this article in which you will undertsand how will write a Onsubmit client script and also your script work on both Desktop as well as Portal Side.

Please ark my answer as correct if it helps you.

Thanks,

Shahebaz