Group Approval Workflow Advance Script

_Samay
Tera Expert

Dear Team,

Hope, you all are doing well.

I’m looking for some help in workflow where in Group Approval Activity at least 6 approvals are required to approve a change. But, not sure how we can achieve this from scripting.

If anyone can help with samples like how does script looks like, then it’s really help me.

Appreciate your help and support.

1 ACCEPTED SOLUTION

Najmuddin Mohd
Mega Sage

Hello @_Samay 

Can you try the below code.

 

answer = '';

for(var id in groups){
	var group = groups[id];
	if(group.rejected >= 1){
		answer = "rejected";
	}
	else{
		var numberOfApprovals = 6;
		var approvedArray = group.approvalIDs["approved"]; // sysId of the users who approved

		gs.log("Approved array: " + approvedArray);

		if(approvedArray.length >= numberOfApprovals){
			answer = "appproved";
		}
	}
}

 

 

If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.

View solution in original post

6 REPLIES 6

Dear @Najmuddin Mohd . Above script looks fine for me, but more help. Any further configuration needs to be done into above script. like where to configure Group Details. 

Hello @_Samay 
In the Approval - Group Activity,

NajmuddinMohd_0-1739815439996.png
You need to add the Approval group in the Groups list collector, 
And click Advanced checkbox and add the script.


If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.