From 8be7ebefeda3e8dd98d3967433114684294e5701 Mon Sep 17 00:00:00 2001 From: Chase Miller <46936509+ChaseMillers@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:46:40 -0700 Subject: [PATCH] Enhance README with usage and functionality details Expanded the README to provide detailed usage instructions, functionality, and use cases for the Clone User script. --- .../README.md | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Server-Side Components/Background Scripts/Clone User with Roles and Groups/README.md b/Server-Side Components/Background Scripts/Clone User with Roles and Groups/README.md index 12aa1fba6f..4fc9000dcf 100644 --- a/Server-Side Components/Background Scripts/Clone User with Roles and Groups/README.md +++ b/Server-Side Components/Background Scripts/Clone User with Roles and Groups/README.md @@ -1,2 +1,29 @@ # Clone User with Roles and Groups -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. + +A background script that clones an existing user's profile including all their roles and group memberships to a new user account. + +## Usage + +1. Navigate to **System Definition → Scripts - Background** +2. Copy and paste the script content +3. Update the function call at the bottom with the source and target user IDs: + ```javascript + cloneUser('source.username', 'new.username'); + ``` +4. Click "Run script" + +## What It Does + +The script: +1. Creates a new user record with the specified username +2. Copies all field values from the source user to the new user (except fields already set) +3. Clones all directly assigned roles (excludes inherited roles) +4. Clones all group memberships +5. Returns the sys_id of the newly created user + +## Use Cases + +- Onboarding new team members with similar access needs +- Creating test users with specific role/group combinations +- Setting up backup user accounts with identical permissions +- Standardizing user setup based on role templates