- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 12:11 PM - edited 02-10-2025 12:21 PM
I have a catalog item that is locked down to a single group via role assignment. I'm looking for something in the form of two-factor approval for it. Therefore the submitter should not get a vote in the approval flow targeted to the same group if they submit it but should if other members submit instead. Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 09:37 PM
Hello @leonard_gilbert
So, you exclude the approval to the user if the requester is same of the approval group. If understanding is correct you can use below logic in your Rules script in Ask for Approval action:
var users = [];
var requester = fd_data.trigger.request_item.requested_for; //get the requester for
var grGrpMem = new GlideRecord("sys_user_grmember");
grGrpMem.addQuery("group", "019ad92ec7230010393d265c95c260dd"); // put your group here
grGrpMem.addQuery("user", requester);
grGrpMem.query();
if(!grGrpMem.hasNext()) {
return 'ApprovesAnyG[019ad92ec7230010393d265c95c260dd]'; //if submitter is not part of the group
} else { //if submitter is part of the group
grGrpMem = new GlideRecord("sys_user_grmember");
grGrpMem.addQuery("group", "019ad92ec7230010393d265c95c260dd");
grGrpMem.addQuery("user" , "!=" , requester); // exclude the requester
grGrpMem.query();
while(grGrpMem.next()) {
users.push(grGrpMem.getValue("user"));
}
return 'ApprovesAnyU['+users+']'; //send the approval to remaining users in the group
}
Hope it helps:)
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 09:37 PM
Hello @leonard_gilbert
So, you exclude the approval to the user if the requester is same of the approval group. If understanding is correct you can use below logic in your Rules script in Ask for Approval action:
var users = [];
var requester = fd_data.trigger.request_item.requested_for; //get the requester for
var grGrpMem = new GlideRecord("sys_user_grmember");
grGrpMem.addQuery("group", "019ad92ec7230010393d265c95c260dd"); // put your group here
grGrpMem.addQuery("user", requester);
grGrpMem.query();
if(!grGrpMem.hasNext()) {
return 'ApprovesAnyG[019ad92ec7230010393d265c95c260dd]'; //if submitter is not part of the group
} else { //if submitter is part of the group
grGrpMem = new GlideRecord("sys_user_grmember");
grGrpMem.addQuery("group", "019ad92ec7230010393d265c95c260dd");
grGrpMem.addQuery("user" , "!=" , requester); // exclude the requester
grGrpMem.query();
while(grGrpMem.next()) {
users.push(grGrpMem.getValue("user"));
}
return 'ApprovesAnyU['+users+']'; //send the approval to remaining users in the group
}
Hope it helps:)
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 08:58 AM
This worked perfectly, exactly what I needed. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 02:22 PM
Glad to resolve your query! @leonard_gilbert
Murthy