isMemberof() for more than group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 12:53 AM
Hi All,
I need to use ismemberof() function for more than group.
Please suggest.
Regards,
Shamma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 01:06 AM
isMember() returns a boolean value i.e true/false.
so you can use an OR to check for multiple groups. something like:
gs.getUser().isMemberOf(group1) || gs.getUser().isMemberOf(group2) || gs.getUser().isMemberOf(group3);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 01:13 AM
Hi Shamma,
Method "isMemberOf()" takes one GroupName/Sys_id as its argument at a time .
What you can do is to loop through an array :
var groupsArray = ['CAB Approval', 'Change Management', 'xyz'];
for(var y=0; y < groupsArray.length; y++){
var isMember = gs.getUser().getUserByID('abc').isMemberOf(groupsArray[y]);
}
PS - Please mark Helpful, Like, or Correct Answer if applicable.
Thanks,
Chetan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 03:06 AM
Thanks Anurag and Chetan. I need to define the same in condition.
I was thinking if we can define in comma separated.
I achieved it by using OR operator.
Regards,
Shamma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 07:13 PM
i'm using this filter current.assignment_group.parent.name.indexOf('IT Always') > -1. and it work. Thank you for replying to my question 😄