Trying to remove the manager as an approver if they are also a member of the group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 10:41 AM
Hello all,
I am looking into the idea of removing or filtering out the assignment group manager if they are also listed as a member of the group. Based on my observations of how the process works is that the approvers are populated based on Change Approval Definitions. These definitions are defined as a user or group based on the Approval Definition parameters, that as far as I can tell, are not really editable in a dynamic way. Am I correct in the conclusion that the manager cannot be filtered out of the approvers if they are also a member of the group defined in the Change Approval Definition?
The reason this is an issue is because many of the assignment group managers are also members of the assignment groups. We are trying to avoid any confusion if a user approved the Change request as a manager or member of the assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 11:32 AM
Creating a Business Rule on the sysapproval_approver table can prevent the manager from being added as an approver if they already exist as a member.
Conditions: Before Insert
source_table == 'change_request'
Code:
var grChange = new GlideRecord('change_request');
if (grChange.get(current.document_id)) {
var assignmentGroup = grChange.assignment_group; // Get Assignment Group
if (assignmentGroup) {
var groupManager = assignmentGroup.manager; // Get Group Manager
// Check if the approver is the manager
if (groupManager == current.approver) {
// Verify if the manager is also a group member
var grGroupMember = new GlideRecord('sys_user_grmember');
grGroupMember.addQuery('group', assignmentGroup);
grGroupMember.addQuery('user', groupManager);
grGroupMember.query();
if (grGroupMember.hasNext()) {
gs.info("Manager is also a member, removing from approvers.");
current.setAbortAction(true); // Prevent insertion
}
}
}
}
Mark it helpful if this helps you to understand. Accept the solution if this gives you the answer you're looking for
Kind Regards,
Priyatam Patchipulusu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 05:19 AM
First, thank you for the reply! This is definitely a 'front runner' solution for me if I cannot figure out how to adjust the action in Flow Designer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 01:22 PM
Hello,
I have had kind of similar requirement in one of my previous implementations. If you are using Flow Designer, try use scripted approval. Here is an article which helped me a lot:
Scripted Approvals in Flow Designer with Flow Variables
If my answer helped you, please accept it as correct and mark helpful, thank you 👍
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 05:23 AM
I found the documentation for the Flow action at: https://www.servicenow.com/docs/bundle/washingtondc-it-service-management/page/product/change-manage... What I found interesting is that SOMEHOW I have extra fields in my Action compared to the ServiceNow documentation. How is that possible?