Checking for group membership from a workflow

Jason Stephens
Kilo Guru

I need to check for membership in a group called "Pre-Approved" in a workflow 'if' activity. Basically if the current requested for is a member of the pre-approved group. How would I do this?

Jason

4 REPLIES 4

ShaneBrazeal
Tera Contributor

Hi Jason,

In the Script field (appears after you check the Advanced check box), you could do a script similar to:



var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('user', current.request.requested_for);
grMem.addQuery('group.name', 'Pre-Approved');
grMem.query();
if(grMem.next()){
answer = 'yes';
}
else{
answer = 'no';
}


Hope this helps!


That got it. Thanks, Shane.

Jason


please mark his answer as correct so the question will be marked as answered and he gets the points.


Thank you Shane, this is just what I needed!