Changing approval count from percentage approval to a count
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2022 01:24 PM
Hello Everyone,
Im looking to change our workflow approval approval conditions from a percetage approval to an static approval count from the members. Im new to javascript and i wanted some feed back on how we can modify our current approval script listed below:
// Approve based on percentage from each group
var approvePercent = 50;
var approveCount = 0;
for(var id in groups){
var group = groups[id];
if((group.approved/group.total)*100 >= approvePercent){
//Mark the group approval record 'Approved'
var groupApproval = new GlideRecord('sysapproval_group');
groupApproval.get(id);
groupApproval.approval = 'approved';
groupApproval.update();
approveCount++;
}
if((group.rejected/group.total)*100 > (100 - approvePercent)){
answer = 'rejected';
break;
}
}
//Ensure all groups have approved
if(approveCount == counts.total){
answer = 'approved';
}
Im thinking that that i would change the var approveCount to 3 and the var approvePercent to 0 but im not sure on how to change the rest of variables that are bolded. Also, do i need to make a modification to the approval definition make this a happen as well.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2024 02:50 PM
You Should Visit this one : https://www.servicenow.com/community/developer-forum/change-management-need-to-modify-approval-count...