We can use the following catalog client script onSubmit var gr = new GlideRecord(“sys_attachment”); gr.addQuery(“table_name”, “sc_cart_item”); gr.addQuery(“table_sys_id”, g_form.getUniqueValue()); gr.query(); if (!gr.next()) { alert(“Attachment mandatory.”); return false; }
Cancel a workflow using a script when any one of RITM approvals are rejected | ServiceNow
Use the following script in the run script activity of the current workflow answer = true; var sag = new GlideRecord(‘sysapproval_group’); sag.addQuery(‘parent’, current.sys_id); sag.query(); while(sag.next()) { if(sag.approval == ‘rejected’) { current.state = ‘4’; var w = new Workflow(); var gr = new GlideRecord(‘wf_context’); if (gr.get(current.context)) w.cancelContext(gr); } }
ServiceNow | Make all the variables read only in the RITM view
function onLoad() { g_form.setVariablesReadOnly(true); }