- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 10:29 PM
Dear Team,
Hope, you all are doing well.
I’m looking for some help in workflow where in Group Approval Activity at least 6 approvals are required to approve a change. But, not sure how we can achieve this from scripting.
If anyone can help with samples like how does script looks like, then it’s really help me.
Appreciate your help and support.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 11:01 PM - edited 02-13-2025 11:29 PM
Hello @_Samay
Can you try the below code.
answer = '';
for(var id in groups){
var group = groups[id];
if(group.rejected >= 1){
answer = "rejected";
}
else{
var numberOfApprovals = 6;
var approvedArray = group.approvalIDs["approved"]; // sysId of the users who approved
gs.log("Approved array: " + approvedArray);
if(approvedArray.length >= numberOfApprovals){
answer = "appproved";
}
}
}
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 10:32 PM
this should work
Percentage or Majority-based Workflow Approvals
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
02-15-2025 07:05 AM
Hope you are doing good.
Did my reply answer your question?
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
02-17-2025 06:16 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 11:01 PM - edited 02-13-2025 11:29 PM
Hello @_Samay
Can you try the below code.
answer = '';
for(var id in groups){
var group = groups[id];
if(group.rejected >= 1){
answer = "rejected";
}
else{
var numberOfApprovals = 6;
var approvedArray = group.approvalIDs["approved"]; // sysId of the users who approved
gs.log("Approved array: " + approvedArray);
if(approvedArray.length >= numberOfApprovals){
answer = "appproved";
}
}
}
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.