Code to make document upload mandatory on a record producer

Execute this as a catalog client script on the record producer, onSubmit method

function onSubmit() {
var cat_id = gel(‘sysparm_item_guid’).value;
var gr = new GlideRecord(“sys_attachment”);
gr.addQuery(“table_name”, “u_ar_package”);
gr.addQuery(“table_sys_id”, cat_id);
if (! {
alert(“You must upload a package prior to submitting.”);
return false;
}else if({
return true;