Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 04:27 AM
I want to add a requested user to a particular group when user not in that group members list.
if a user submitted a from this need to be perform.
this code is not working:
var username = current.variables.u_requestor;
var group = 'WindowsCorp';
var user = new GlideUser();
if (user.get(username)) {
var gro=new GlideRecord('sys_user_group');
var e=gro.get('name',group);
if (e) {
user.addMember(group.getUniqueValue());
gs.info('User ' + username + ' successfully added to the group ' + group);
} else {
gs.error('User ' + username + ' is already a member of the group ' + group);
}
}
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 04:29 AM
Hi @Aditya02
please refer below link
If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.
Thanks
dgarad
Thanks
dgarad
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 04:29 AM
Hi @Aditya02
please refer below link
If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.
Thanks
dgarad
Thanks
dgarad