Auto Reject approval script (Add exceptions)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 03:50 AM
Per current setup all the requests are auto rejected with 8 days except for one group lets name is A.
Script is already in place of it.
New requirement is to set exception for three group, lets name them A,B,C
How to update existing script to add B, C also.
Current script:
var ca = new GlideRecord('sysapproval_approver');
ca.addQuery('state', 'requested');
ca.addQuery('sys_created_on', '<', gs.daysAgo(8));
//Update: Adding condition
var cancelOR = ca.addQuery('group.assignment_group.name', '!=', 'A');
cancelOR.addOrCondition('group', '');
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 07:40 AM
I would suggest to read up on the gliderecord query capability a quick google can show you how to do this but for reference you would do something like the flowing
var exemptGroups = ['A', 'B', 'C'];
ca.addEncodedQuery("sys_idNOT IN"+exemptGroups);
Refer to this guide as well that a community member has made that is helpful
Hope that helps!