- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2025 05:27 AM
We are buiding a process where users can fill out a Multi Row Variable Set (MRVS), and from that, we will build Group Approvals. The MRVS only has two fields: Approval Group to assign to, and Comments.
I am building a Flow to create Group Approvals for each record entered into the MRVS. Related to that, I am trying to build a Custom Action that will do the following:
1. Create the Group Approval
2. After step 1, loop through all the related records in the sysapproval_approver table to update the Comments field along with a custom Approval Type field we have on this table.
Here is the script I have:
(function execute(inputs, outputs) {
//initialize Group Approval sys_id
var ga_sys_id = '';
//insert new record into Group Approval table
var approvalGR = new GlideRecord("sysapproval_group");
approvalGR.initialize();
approvalGR.parent = inputs.ritm_sys_id;
approvalGR.assignment_group = inputs.app_grp;
approvalGR.approval = "requested";
approvalGR.wait_for = 'any';
var newSysID = approvalGR.insert();
//get number of new Group Approval record
if(newSysID){
var approvalGR2 = new GlideRecord("sysapproval_group");
if(approvalGR2.get(newSysID)){
//store Group Approval Number
outputs.grp_num = approvalGR2.getValue('number');
//capture group approval record sys_id
ga_sys_id = approvalGR2.sys_id;
}
}
//update approval type and comments on user approvals
var grApp = new GlideRecord("sysapproval_approver");
grApp.addQuery('group',ga_sys_id);
grApp.query();
while(grApp.next()){
grApp.u_approval_type = inputs.app_type;
grApp.comments = inputs.cmnt;
grApp.document_id = inputs.ritm_sys_id;
grApp.sysapproval = inputs.ritm_sys_id;
grApp.approval_column = 'approval';
grApp.approval_journal_column ="approval_history";
grApp.update();
}
})(inputs, outputs);
It all seems to work properly in that it creates the Group Approval records, and updates each related record in the sysapproval_approver table, like I expect. However, the behavior of these created records is not quite right. I want to to behave that only one person needs to approve/reject each Group Approval. Then, all the other sysapproval_approver records related to that particular Group Approval are marked as "No longer required". However, this doesn't do that. All the other records are still left as "Requested".
I tried to go back and emulate/set all the field values to match the settings for approval records that are created using the built-in OOTB "Ask for Approval" record (which works properly), but I must be missing something, as I cannot get it to behave the same way as this OOTB Action.
I also tried to search to see if I could find what updates all the other records to "No longer required" when one is approved or rejected. I figure if I can find this rule, I can see what it is looking for, and it might be evident what I need to add or adjust to my code. I searched Workflow, Flows, Business Rules, and Client Scripts, and was not able to find it.
Can anyone help?
Either let me know what I need to add/change to my code to allow this "No longer required" functionality to work, or let me know what runs to change the approvals to "No longer required"?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2025 06:36 AM
see if these links help, if not then switch to workflow
see these blogs and the KB from ServiceNow
Parallel Approvals in Flow Designer
Parallel Approvals in Flow Designer
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
09-22-2025 12:22 PM
Good news! I met with the team and was able to convince them not to use parallel approvals in this manner, so we don't have to go down that road.
Thanks for the information though. It is quite helpful to know that it cannot be done easily, or at least not without some extra coding (a path we really do not want to go down if we do not have to!).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 08:16 PM
Glad to help.
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
