Approvals are not set to "No longer required"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I have a requirement that when group approval is triggered for a request, and if any new members added to that group, then that users should also see the approval record.
I have created a after BR on sys_user_grmember table, currently when request is created and group approval triggered and afterwards when i add new users to that group, the users could see the approval record. the issue is when the request is approved by anyone of the group member, other approval records are moved to "no longer required", but newly inserted approvals on sysapproval_approver are not moved to "no longer required", still is in "requested" state.
Any help would be appreciated. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
at that time of group approval request whatever members are there they will get approval request
why you want to handle the adhoc group members?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @Ankur Bawiskar ,
newly added users of the group should also have the control of pending approval records, that is the scenario. But until adding new users to the approver table was done by custom BR, but when approving it, others not moving to "no longer required", some ootb script might be invloved, couldn't figure it out.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @MS17 ,
In that case you can create one more custom BR to make state as "no longer required" if all other approvals related to that record is changed to approved state.
Thanks,
Akshay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Akshay37 ,
inserting new users we can manually do it, but after that it should adapt the ootb logic right, when approve/reject. that is what i am trying to do.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi, hope that can help:
(function executeRule(current, previous) {
var groupId = current.group;
var userId = current.user;
var appr = new GlideRecord('sysapproval_group');
appr.addQuery('assignment_group', groupId);
appr.addQuery('approval', 'requested');
appr.query();
while (appr.next()) {
var grpAppr = new GlideRecord('sysapproval_approver');
grpAppr.addQuery('group', appr.sys_id);
grpAppr.query();
if (grpAppr.next()) {
var newAppr = new GlideRecord('sysapproval_approver');
newAppr.initialize();
newAppr.sysapproval = appr.parent;
newAppr.group = appr.sys_id;
newAppr.state = appr.approval;
newAppr.approver = userId;
newAppr.document_id = grpAppr.document_id;
newAppr.source_table = grpAppr.source_table;
newAppr.wf_activity = grpAppr.wf_activity;
newAppr.insert();
}
}
})(current, previous);