Stop a catalog item from being submitted if a field is not filled in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 06:32 AM
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:
When to Run:
Catalog UI Action:
Catalog UI Policy Script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 06:37 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 06:39 AM
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