- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 03:43 AM
Hello,
I wrote an on submit script to make attachment mandatory that is visible on service portal or esc, but this script is not running on glideapp.servicecatalog_cat_item_view. Below screenshot for your reference. Please suggest .
I have written 2 same on submit script, one for desktop and other for mobile/service portal.
This script is working on Service Portal but not on glideapp.
When I selected all in catalog client scripts I got below error , so created two separate catalog client scripts.
Script:
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 04:36 AM
Ensure the script I've provided you with is in an onsubmit catalog client script with the UI Type of 'desktop'. Delete your other script(s) you've created as they're not needed. Then use the checkbox function I mentioned previously to control the mandatory attachment requirement in the portal.
TL;DR - The script is making attachments mandatory in the glideapp backend view, the OOB functionality of the "Mandatory attachments" checkbox on the catalog item is controlling the portal/mobile view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 03:49 AM
As your script isn't conditional, you can set the mandatory flag on the catalog item record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 03:53 AM
Hi Kieran,
I tried but this is also not running on glideapp.servicecatalog_cat_item_view.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 04:07 AM
I wasn't aware that it didn't apply to the backend.
You can create a new onSubmit client script with a UI type of 'Desktop' and in the script
function onSubmit() {
var attachmentCount = Number(getCurrentAttachmentNumber())
if(attachmentCount == 0){
g_form.addErrorMessage(getMessage('error_message_key'))
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 04:26 AM
I tried this script. It is working on backend as well that is glideapp but the issue is I am getting error too 'There is a javascript browser code error'.
Please let me know how to resolve this.