- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 01:30 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:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 02:05 AM
Hi @Nikita50 ,
Please replace the code as below and try
var ca = new GlideRecord('sysapproval_approver');
ca.addQuery('state', 'requested');
ca.addQuery('sys_created_on', '<', gs.daysAgo(8));
//Update: Adding condition
// **Update the below line to addEncodedQuery condition**
var cancelOR = ca.addQuery('group.assignment_group.name', '!=', 'A');
//Updated Query
var cancelOR = ca.addEncodedQuery("group.assignment_group.name!=AORgroup.assignment_group.name!=BORgroup.assignment_group.name!=C");
cancelOR.addOrCondition('group', '');
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 02:05 AM
Hi @Nikita50 ,
Please replace the code as below and try
var ca = new GlideRecord('sysapproval_approver');
ca.addQuery('state', 'requested');
ca.addQuery('sys_created_on', '<', gs.daysAgo(8));
//Update: Adding condition
// **Update the below line to addEncodedQuery condition**
var cancelOR = ca.addQuery('group.assignment_group.name', '!=', 'A');
//Updated Query
var cancelOR = ca.addEncodedQuery("group.assignment_group.name!=AORgroup.assignment_group.name!=BORgroup.assignment_group.name!=C");
cancelOR.addOrCondition('group', '');
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 03:45 AM
This is not working. Marked as correct by mistake.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 03:50 AM
Hi @Nikita50 ,
Did you try the below:
var ca = new GlideRecord('sysapproval_approver');
ca.addQuery('state', 'requested');
ca.addQuery('sys_created_on', '<', gs.daysAgo(8));
//Update: Adding condition
var cancelOR = ca.addEncodedQuery("group.assignment_group.name!=AORgroup.assignment_group.name!=BORgroup.assignment_group.name!=C");
cancelOR.addOrCondition('group', '');
Please let me know if this is not working and share the whole code.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 03:55 AM
yes i did that