Approval issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 11:11 PM
Hi All,
We're implementing group approval for RITM using UI actions, where if any member of the group approves, the approvals to other users should be marked as "not required." However, it seems this isn't functioning correctly. What changes do I need to make in the code to achieve this? It's already set the wait condition to "Anyone to approve."
if (group) {
var grApprovalGroup = new GlideRecord('sysapproval_group');
grApprovalGroup.initialize();
grApprovalGroup.assignment_group = group;
grApprovalGroup.source_table = current.getTableName();
grApprovalGroup.comments = current.variables.additional_comments;
grApprovalGroup.parent = current.sys_id;
grApprovalGroup.approval = 'requested';
grApprovalGroup.insert();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 11:28 PM
your above script is inserting the approvals.
You will have to write after update BR on approval table and check if any 1 person approves then mark others as Not required
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 11:36 PM
something like this in after update BR on sysapproval_group
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("group", current.getUniqueValue());
gr.addQuery("sysapproval", current.parent);
gr.addEncodedQuery('state!=approved'); // exclude the record which got approved
gr.query();
while (gr.next()) {
gr.state = 'not_required';
gr.update();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 11:40 PM
if this is required only for Change Request then add this condition in BR condition
current.parent.sys_class_name == 'change_request'
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 12:02 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader