Add users to multiple groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2014 01:28 PM
Hello,
I am trying to add a user that was inserted to a group (Let's say "A"), to 3 other groups (Let's say B,C,D). So whenever a user is added to group "A", that user should automatically be added to groups "B,C, and D". So far I came out with the script to add a user to a single group but I cannot accomplish to add the same user to the other 3. Have anyone done such script? Do you have any recommendations? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2014 01:55 PM
add the group to the other groups.. so group a would be a member of groups b and c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2014 03:08 PM
After insert BR on sys_user_grmember
Condition: group = <group_sysid>
var group = new GlideRecord('sys_user_group');
group.addQuery('sys_id', 'IN', '<sysid1>, <sysid2>, <sysid3>');
group.query();
while(group.next()){
var usgr = new GlideRecord('sys_user_grmember');
usgr.initialize();
usgr.user = current.user;
usgr.group = group;
usgr.insert();
}
Or something like that. Play around with it and you'll get it.