- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:15 AM
How to assign role automatically for imported users? I scheduling a job to run to import new users every week and i want to assign role 'end_user_new' to these users automatically, how to do that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:31 AM
Hi,
I also suggest you tag the role to a group and add user in the group which is the best practice.
if(action =="insert"){
var gr = new GlideRecord('sys_user_grmember');
gr.initialize();
gr.user = target.sys_id; //After new user is inserted
gr.group = 'sys_id_of_group'; // Tag the role to a group & add users in group
gr.insert();
}
Thanks
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:20 AM
Hi,
In your transform map, write an onAfter script and assign end_user_new role once the user is inserted.
Thanks
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:31 AM
Hi,
I also suggest you tag the role to a group and add user in the group which is the best practice.
if(action =="insert"){
var gr = new GlideRecord('sys_user_grmember');
gr.initialize();
gr.user = target.sys_id; //After new user is inserted
gr.group = 'sys_id_of_group'; // Tag the role to a group & add users in group
gr.insert();
}
Thanks
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:38 AM
Hi alikutty,
You are telling i need to write transform script, to add user to a group?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:43 AM
Yes and you should add the role to this group, This will help in maintenance. It is not a best practice to directly tag roles to a user.
Thanks
PS: Hit like, Helpful or Correct depending on the impact of the response