Skip to content

Commit 8be7ebe

Browse files
authored
Enhance README with usage and functionality details
Expanded the README to provide detailed usage instructions, functionality, and use cases for the Clone User script.
1 parent 95ca253 commit 8be7ebe

File tree

1 file changed

+28
-1
lines changed
  • Server-Side Components/Background Scripts/Clone User with Roles and Groups

1 file changed

+28
-1
lines changed
Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
11
# Clone User with Roles and Groups
2-
I have created a script in ServiceNow to replicate a user's profile. This script not only duplicates the user's data but also replicates the roles and groups assigned to that user.
2+
3+
A background script that clones an existing user's profile including all their roles and group memberships to a new user account.
4+
5+
## Usage
6+
7+
1. Navigate to **System Definition → Scripts - Background**
8+
2. Copy and paste the script content
9+
3. Update the function call at the bottom with the source and target user IDs:
10+
```javascript
11+
cloneUser('source.username', 'new.username');
12+
```
13+
4. Click "Run script"
14+
15+
## What It Does
16+
17+
The script:
18+
1. Creates a new user record with the specified username
19+
2. Copies all field values from the source user to the new user (except fields already set)
20+
3. Clones all directly assigned roles (excludes inherited roles)
21+
4. Clones all group memberships
22+
5. Returns the sys_id of the newly created user
23+
24+
## Use Cases
25+
26+
- Onboarding new team members with similar access needs
27+
- Creating test users with specific role/group combinations
28+
- Setting up backup user accounts with identical permissions
29+
- Standardizing user setup based on role templates

0 commit comments

Comments
 (0)