File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Client-Side Components/Catalog Client Script/Set and Lock variable by Group Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ function onLoad() {
2+ var variableName = 'bypass_approval_reason';
3+ var targetGroupName = 'ServiceNow Support'; // The group authorized to skip this step
4+ var ga = new GlideAjax('UserUtils');
5+ ga.addParam('sysparm_name', 'isMemberOf');
6+ ga.addParam('sysparm_group_name', targetGroupName);
7+ ga.getXMLAnswer(checkAndLockVariable);
8+ function checkAndLockVariable(response) {
9+ var isMember = response;
10+ if (isMember == 'true') {
11+ var message = 'Value set and locked due to your ' + targetGroupName + ' membership.';
12+ var setValue = 'Bypassed by authorized ' + targetGroupName + ' member.';
13+ g_form.setValue(variableName, setValue);
14+ g_form.setReadOnly(variableName, true);
15+ g_form.showFieldMsg(variableName, message, 'info');
16+ } else {
17+ g_form.setReadOnly(variableName, false);
18+ }
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments