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

Please format your code as code using the advanced editor so it's easier to read.



What I notice about your code, is that most of what you want to do using the "group" variable, is outside of the FOR loop in which it is declared.


But I don't understand exactly what you're trying to do -- you don't ever seem to actually count up the number of approvals you have, or anything. Can you explain what this code is doing, or document it in some way?


Hello — I need to get the count of users who has approved in a group and not the number of groups which has approved.



This is taken from docs.service-now.com and I this question is to get clarified in things. Can you see form WIKI here?



If the Wait for variable is set to Condition based on script this script is called to determine how to handle an approval or rejection. The script needs to set the variable answer to approved or rejected to indicate the overall status for this approval.


This script is responsible for setting the approval state for each group that is part of this approval activity before returning the overall approval state for all of the groups.


When called, the following variables are available to the script for all the groups that are part of this approval activity:


counts.total = total number of groups that are part of this approval


counts.approved = # of groups that approved so far


counts.rejected = # of groups that rejected so far


counts.requested = # of groups that are pending approval


counts.not_requested = # of groups that are not pending approval


counts.not_required = # of groups that approval is not required


And for each group:


groups[group_id].total = total number of users that are part of this group's approval


groups[group_id].approved = # of users that approved so far


groups[group_id].rejected = # of users that rejected so far


groups[group_id].requested = # of users that are pending approval


groups[group_id].not_requested = # of users that are not pending approval


groups[group_id].not_required = # of users that approval is not required


groups[group_id].approvalIDs[state] = array of user ids that are at the specified approval state


Note: Iterate the groups using:


for (var id in groups) {


var group = groups[id];


... group.total ...


}


I apologize, but I wasn't able to understand anything you just said.


Rahul Kathuria
Tera Expert

Hi vinitha, any updates on this? Did the solution work?



Thanks


Rahul Kathuria


I can update it today during my time.





Sent from my vivo smart phone