Dynamic Role creation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2017 10:27 PM
Hi All,
i have a level field, depends on level is it possible to allocate the role dynamically without creating the group??
i dont want to create a group and assign the role to group, i need to allocate the role depends upon level is it possible?
please help me in this scenario.
Regards
Venkat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2017 10:41 PM
Hi Venkat,
You can try adding a business rule on sys_user table.
As soon as a record is set and level is added there, you can pick the level value and decide which roles you need to add to the user,
Just Query down sys_user_has_role table and try below script in the BR.
var gr = new GlideRecord('sys_user_has_role');
gr.initialize();
gr.user=current.sys_id; //sys_id of the user
gr.role="add sys_id of the role";
gr.state='active';
gr.insert();
Please mark the response correct/helpful based on the impact.
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 01:36 AM
Thanks @Gaurav Bajaj , It helped for me 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 01:50 AM
Is your Level field on User table?
Also you want to implement it for Existing Users with Level value or for User when Level is updated?