Group Approval restrict to 2 members

vinitha3
Tera Guru

When approval is set to a Group, I want only two member to approve.

What happens is, when one member approves then the rest are set to no longer required.

Under group approval script, wait for condition is set to a script.

Any ideas?

Thanks,

Vinitha.K

26 REPLIES 26

vinitha3
Tera Guru

Yes, what happens is during the first approval itself all are set to no longer required.


In the "Wait for" field of the approval activity choose option as An approval from everyone from all groups


Rahul Kathuria
Tera Expert

vinitha,You can use this code






//Set the variable 'answer' to '', 'approved' or 'rejected' to indicate the approval status for this approval.   When called, the following information is available:



//



//       counts.total = total number of users that are part of this approval



//       counts.approved = # of users that approved so far



//       counts.rejected = # of users that rejected so far



//       counts.requested = # of users that are pending approval



//       counts.not_requested = # of users that are not pending approval



//       counts.not_required = # of users that approval is not required



//



//var cab_total = counts.total;  




 


var cab_approved = counts.approved;



var cab_rejected = counts.rejected;



var cab_approvals_needed = 2;




 


if (cab_rejected > 0) { answer = 'rejected'; }



if (cab_approved >= cab_approvals_needed) { answer = 'approved'; }




 


Thanks & Regards,



Rahul Kathuria


vinitha3
Tera Guru

Rahul,


this script is waiting for all the users in the group to approve.


No idea what I am missing.



Thanks,


Vinitha.K


Hello,



No, it isn't waiting for all users in the group. It's just waiting for two. At least, ostensibly. If it doesn't work for you, surely you can get the gist and rewrite it for your instance.


See lines 3 and 6 below.



var cab_approved = counts.approved;


var cab_rejected = counts.rejected;


var cab_approvals_needed = 2;



if (cab_rejected > 0) { answer = 'rejected'; }


if (cabapproved >= cab_approvals_needed) { answer = 'approved'; }