User is created when we select any department then ITIL should be added
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2024 10:11 AM
User is created when we select any department then ITIL should be added

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2024 01:30 AM
There isn't much information to go off based on your question.
I assume that the user is created and when an admin/user_admin applies a department the role should automatically be added.
I would suggest using a before update business rule.
Table - Sys_User
Condition - Department ISNOTEMPTY
Script -
var usrRole = new GlideRecord('sys_user_has_role');
usrRole.initialize();
usrRole.user = current.sys_id;
usrRole.state = 'active';
usrRole.role = <SYS_ID OF ITIL ROLE>
usrRole.insert();
This would automatically apply the itil role to any user if the record is updated so that the department field is populated. I would suggest adding some additional validation to ensure that this does not run on users who already have the itil role.