Skip to content

Commit 85cd7a6

Browse files
committed
Modify top-level folder to Business Rules
1 parent 414b638 commit 85cd7a6

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

Background Scripts/Automate Role Assignment for New User/README.md

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Overview
2+
This snippet for ServiceNow developers automate the process of assigning roles to users based on their department. It helps to simplify user role management, especially useful in organizations where specific departments require predefined access levels.
3+
4+
# How It Works
5+
In Business Rule settings within ServiceNow:
6+
- Trigger: runs the script "before" an update to the `sys_user` table when a user’s department changes.
7+
- Condition: Only triggers when `current.department.changes()` - ensures that the script only runs when the department field is modified.
8+
- Role Mapping: Uses the `rolesByDepartment` dictionary to assign roles based on the user’s department.
9+
10+
# Implementation
11+
12+
Edit `rolesByDepartment` to match your organization’s needs.
13+
14+
```
15+
var rolesByDepartment = {
16+
<department_name> : [role_1, role_2]
17+
};
18+
```

0 commit comments

Comments
 (0)