Need to calculate the approval count greater than 50% in the Approval group activity in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2014 03:50 AM
Hi All,
In the Change Workflow for a particular group i need to calculate the % approvals.If the % of Approvals greater than 50% then only it is supposed to be Approved.For this wrote a code and its working fine but i gave that in "APPROVAL USER ACTIVITY " in the workflow. If i change that to "APPROVAL GROUP ACTIVITY" its not working. My intention of changing the Activity from USER to GROUP is to get the Name of the Assignment group to which the Particular Approver belongs in the APPROVERS Related List in the Change Form.
Code used in Approval User Activity
try{
var approvePercent = 50;
if((counts.approved/counts.total)*100 >= approvePercent){
answer = 'approved';
}
if((counts.rejected/counts.total)*100 > (100 - approvePercent)){
answer = 'rejected';
}
}
catch(e){
}
Please suggest if you faced this.
Thanks in Advance.
Sivaranjani.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2015 11:49 PM
Hi Mark,
Hope you are doing good.
Did you get any chance to look into it? Just let me know in case you want any other details.
Thanks,
Vaigai.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2015 02:22 AM
Hi Vaigai,
If im not wrong you want the approval to be rejected when 50 percent of group members rejects the change rite??
If so you need to give if((group.rejected/group.total)*100 >= (100 - approvePercent)){
"=" is missing in your condition since you gave > it waits for more than 50 percent that is more than one person( if that group consists of two members)
Thanks
Sivaranjani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2021 03:27 PM
Hi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2021 08:14 AM
Something like that may require some sort of lookup table to match approval groups with the appropriate approval count.
I haven't tested this, but you could probably nest several group approval records (each with their own count script) within a single approval coordinator activity that could make the ultimate decision for that approval step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2023 09:41 PM
Hi..
I have undestood the script but one doubt.
(counts.rejected/counts.total)*100 > (100 - approvePercent)) - this line I did not get it.
If you could help me little. So I can clear the interview.
Thanks in advance