Catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 06:29 AM
Hi,
I am creating a new catalog item where I need to check if there is an attachment before submitting the request, but that onSubmit client script is throwing an error.
Can someone please help what is the issue and how can I rectify it?
function onSubmit() {
//Type appropriate comment here, and begin script below
var cat_id_return = gel('sysparm_item_guid').value;
alert('Happy '+cat_id_return);
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "sc_cart_item");
gr.addQuery("table_sys_id", cat_id_return);
gr.query();
if (!gr.next()) {
alert("Please attach the Mandatory attachment for Bulk Upload.");
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 07:13 AM
Are you able to use the OOB mandatory attachment option?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 01:29 AM
You can make the attachment mandatory by configuring it in the catalog item record.