UI Macro for the ProgressBar – Jelly Scripting

<?xml version=”1.0″ encoding=”utf-8″ ?> <j:jelly trim=”true” xmlns:j=”jelly:core” xmlns:g=”glide” xmlns:j2=”null” xmlns:g2=”null”> <j:set var=”jvar_renderer” value=”SimpleProgressBar”/> <g:evaluate var=”jvar_choices” jelly=”true” object=”true”> // get the api var api = new SNC.RendererAPI(‘$[jvar_renderer]’); var showValue = api.getOption(‘showValue’)+”; // build the full set of choices including subflows var choices = api.getParentWorkflowChoices(current, jelly.jvar_ref); choices; </g:evaluate> <g:evaluate var=”jvar_increment” jelly=”true” > var increment = 100.00 / […]

Mark users as VIP based on their Group

var vip_grm = new GlideRecord(‘sys_user_grmember’); vip_grm.addQuery(‘group’, ‘SNVIP’); vip_grm.query(); while (vip_grm.next()) { var vip_rec = new GlideRecord(‘sys_user’); vip_rec.addQuery(‘sys_id’, vip_grm.user); vip_rec.query(); while (vip_rec.next()) { vip_rec.vip = true; vip_rec.update(); } }

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; } }