Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

If requester is part of approval group want to skip approval for

srinath1391
Tera Contributor

Hi All,

 

I have a workflow where I'm using the "Approval -user" activity. I want to skip the approval for the requester if he is part of of group .

 

Currently, my script works fine for checking if the requester is part of the approval group and skipping his approval

trigger approvals to other users  but same logic i want to implement for "approval group" activity but not working  . Can anyone suggest the best approach to achieve group approvals in this Scenario?

script

var answer=[];
var requester='123343443333';
var Group='fdhfjksdhkjfkdhkj';
var groupMemberGR = new GlideRecord('sys_user_grmember');

groupMemberGR.addEncodedQuery("user!="+requester+"^group="+Group);
groupMemberGR.query();

// Remove the user from the group if found
while (groupMemberGR.next()) {
	
answer.push(groupMemberGR.getValue('user'));

}

Thanks in advance for your help!

 

Regards,

Srinath.

My  requirement 

2 REPLIES 2

SnR471370208927
Giga Contributor

Hi Srinath,

Did you find the solution? Am looking for the same configuration.

 

Regards,

SN

VernYerem
Tera Expert

"best" is really what works for you. I try to avoid scripts where possible, so for this case we actually created a subflow that identifies the user as part of a group, then passes the result back to the flow to create/avoid the approval.