Checking for group membership from a workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2012 07:16 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2012 08:41 AM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2012 09:14 AM
That got it. Thanks, Shane.
Jason
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 01:30 PM
please mark his answer as correct so the question will be marked as answered and he gets the points.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2015 11:09 AM
Thank you Shane, this is just what I needed!