Group Approval restrict to 2 members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 09:47 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 10:10 AM
Yes, what happens is during the first approval itself all are set to no longer required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 10:14 AM
In the "Wait for" field of the approval activity choose option as An approval from everyone from all groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 10:14 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 10:28 AM
Rahul,
this script is waiting for all the users in the group to approve.
No idea what I am missing.
Thanks,
Vinitha.K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 11:13 AM
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'; }