Tuesday, May 2, 2017

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);
        gr.query();
        if (!gr.next()) {
                alert("You must upload a package prior to submitting.");
                return false;
        }else if(gr.next()){
                return true;
        }
}



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.