From 44176a57ac0cc07f273119d3930ab6cf40112354 Mon Sep 17 00:00:00 2001 From: JohanDC-1999 <82451675+JohanDC-1999@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:19:37 +0200 Subject: [PATCH 1/6] Create readme.md --- .../Show Logged-in User roles/readme.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md diff --git a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md new file mode 100644 index 0000000000..c33c9aac5e --- /dev/null +++ b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md @@ -0,0 +1,18 @@ +# ServiceNow User Info Bookmarklet + +A simple, client-side bookmarklet to display the current ServiceNow user's details in a pop-up modal. It's designed for developers, testers, and administrators who need to quickly check a user's name, sys_id, and full list of assigned roles + +## Features + +* **Displays Key User Info**: Shows Full Name, User Name, and User ID (sys_id) +* **Shows All Roles**: Lists the complete, sorted array of roles, including inherited roles + + +## How to Use + +1. Create a new bookmark in your browser +2. For the name, enter something memorable like **SN User Info** +3. Copy the code from the block below +4. Paste the code into the **URL** or **Address** field of the bookmark +5. Save the bookmark +6. While on any ServiceNow page, click the bookmark to activate the modal From 3c86dfb28965c29ccb341a591520be394e9e344c Mon Sep 17 00:00:00 2001 From: JohanDC-1999 <82451675+JohanDC-1999@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:20:32 +0200 Subject: [PATCH 2/6] Create user_info_bookmarklet.js --- .../Show Logged-in User roles/user_info_bookmarklet.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js diff --git a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js new file mode 100644 index 0000000000..b2cd4093f3 --- /dev/null +++ b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js @@ -0,0 +1 @@ +javascript:(function(){var e=null;"undefined"!=typeof g_user&&g_user.userName?e=g_user:"undefined"!=typeof gsft_main&&gsft_main.g_user&&gsft_main.g_user.userName&&(e=gsft_main.g_user);if(!e)return void alert("ServiceNow user object (g_user or gsft_main.g_user) not found. Are you on a ServiceNow page and logged in?");var n=document.getElementById("sn-user-modal");n&&n.parentNode.removeChild(n);var o=e.allRoles.filter(function(e){return e}).sort().join("
"),t='

User Details

Full Name: '+e.fullName+'

User Name: '+e.userName+'

User ID (sys_id): '+e.userID+'

All Roles ('+e.allRoles.filter(function(e){return e}).length+')

'+o+"
",l=document.createElement("div");l.id="sn-user-modal";var d="#sn-user-modal-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.6);z-index:9999;}#sn-user-modal-content{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#fff;padding:25px;border-radius:8px;box-shadow:0 5px 15px rgba(0,0,0,0.3);width:550px;max-width:90%;max-height:90vh;z-index:10000;box-sizing:border-box;}#sn-user-modal-body{max-height:calc(90vh - 100px);overflow-y:auto;}#sn-user-modal-close{position:absolute;top:10px;right:15px;font-size:28px;font-weight:bold;cursor:pointer;color:#888;line-height:1;}#sn-user-modal-close:hover{color:#000;}";function i(){var e=document.getElementById("sn-user-modal");e&&e.parentNode.removeChild(e)}l.innerHTML="
×
'+t+"
",document.body.appendChild(l),document.getElementById("sn-user-modal-close").addEventListener("click",i),document.getElementById("sn-user-modal-backdrop").addEventListener("click",i)})(); From f2e1a0dce4c50de0cc3de5a9c32e317c6e5c88f1 Mon Sep 17 00:00:00 2001 From: JohanDC-1999 <82451675+JohanDC-1999@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:21:04 +0200 Subject: [PATCH 3/6] Update readme.md --- .../Browser Bookmarklets/Show Logged-in User roles/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md index c33c9aac5e..ccbda9126c 100644 --- a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md +++ b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md @@ -12,7 +12,7 @@ A simple, client-side bookmarklet to display the current ServiceNow user's detai 1. Create a new bookmark in your browser 2. For the name, enter something memorable like **SN User Info** -3. Copy the code from the block below +3. Copy the code from user-info-bookmarklet.js 4. Paste the code into the **URL** or **Address** field of the bookmark 5. Save the bookmark 6. While on any ServiceNow page, click the bookmark to activate the modal From 16dd207aba1102e0a06bd583dfb77394daaff386 Mon Sep 17 00:00:00 2001 From: JohanDC-1999 <82451675+JohanDC-1999@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:21:42 +0200 Subject: [PATCH 4/6] Update readme.md --- .../Browser Bookmarklets/Show Logged-in User roles/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md index ccbda9126c..685083a3d6 100644 --- a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md +++ b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md @@ -12,7 +12,7 @@ A simple, client-side bookmarklet to display the current ServiceNow user's detai 1. Create a new bookmark in your browser 2. For the name, enter something memorable like **SN User Info** -3. Copy the code from user-info-bookmarklet.js +3. Copy the code from user_info_bookmarklet.js 4. Paste the code into the **URL** or **Address** field of the bookmark 5. Save the bookmark 6. While on any ServiceNow page, click the bookmark to activate the modal From 67e0aa62cefb6660727d983a107ae2c011d416f5 Mon Sep 17 00:00:00 2001 From: JohanDC-1999 <82451675+JohanDC-1999@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:48:09 +0200 Subject: [PATCH 5/6] Update user_info_bookmarklet.js Made changes so it should work in workspace as well --- .../Show Logged-in User roles/user_info_bookmarklet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js index b2cd4093f3..932f8fb0ce 100644 --- a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js +++ b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/user_info_bookmarklet.js @@ -1 +1 @@ -javascript:(function(){var e=null;"undefined"!=typeof g_user&&g_user.userName?e=g_user:"undefined"!=typeof gsft_main&&gsft_main.g_user&&gsft_main.g_user.userName&&(e=gsft_main.g_user);if(!e)return void alert("ServiceNow user object (g_user or gsft_main.g_user) not found. Are you on a ServiceNow page and logged in?");var n=document.getElementById("sn-user-modal");n&&n.parentNode.removeChild(n);var o=e.allRoles.filter(function(e){return e}).sort().join("
"),t='

User Details

Full Name: '+e.fullName+'

User Name: '+e.userName+'

User ID (sys_id): '+e.userID+'

All Roles ('+e.allRoles.filter(function(e){return e}).length+')

'+o+"
",l=document.createElement("div");l.id="sn-user-modal";var d="#sn-user-modal-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.6);z-index:9999;}#sn-user-modal-content{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#fff;padding:25px;border-radius:8px;box-shadow:0 5px 15px rgba(0,0,0,0.3);width:550px;max-width:90%;max-height:90vh;z-index:10000;box-sizing:border-box;}#sn-user-modal-body{max-height:calc(90vh - 100px);overflow-y:auto;}#sn-user-modal-close{position:absolute;top:10px;right:15px;font-size:28px;font-weight:bold;cursor:pointer;color:#888;line-height:1;}#sn-user-modal-close:hover{color:#000;}";function i(){var e=document.getElementById("sn-user-modal");e&&e.parentNode.removeChild(e)}l.innerHTML="
×
'+t+"
",document.body.appendChild(l),document.getElementById("sn-user-modal-close").addEventListener("click",i),document.getElementById("sn-user-modal-backdrop").addEventListener("click",i)})(); +javascript:(function(){var e=null;if("undefined"!=typeof g_user&&g_user.userName)e=g_user;else if("undefined"!=typeof gsft_main&&gsft_main.g_user&&gsft_main.g_user.userName)e=gsft_main.g_user;else if("undefined"!=typeof window.NOW&&window.NOW.user&&"undefined"!=typeof window.ux_globals&&window.ux_globals.session)try{e={fullName:window.ux_globals.session.output.user.fullName,userName:window.ux_globals.session.output.user.userName,userID:window.NOW.user.userID,allRoles:window.ux_globals.session.output.user.roles}}catch(o){e=null}if(!e)return void alert("Could not find a ServiceNow user object (g_user, gsft_main.g_user, or Workspace objects). Are you on a ServiceNow page and logged in?");var n=document.getElementById("sn-user-modal");n&&n.parentNode.removeChild(n);var o=e.allRoles.filter(function(e){return e}).sort().join("
"),t='

User Details

Full Name: '+e.fullName+'

User Name: '+e.userName+'

User ID (sys_id): '+e.userID+'

All Roles ('+e.allRoles.filter(function(e){return e}).length+')

'+o+"
",l=document.createElement("div");l.id="sn-user-modal";var d="#sn-user-modal-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.6);z-index:9999;}#sn-user-modal-content{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#fff;padding:25px;border-radius:8px;box-shadow:0 5px 15px rgba(0,0,0,0.3);width:550px;max-width:90%;max-height:90vh;z-index:10000;box-sizing:border-box;}#sn-user-modal-body{max-height:calc(90vh - 100px);overflow-y:auto;}#sn-user-modal-close{position:absolute;top:10px;right:15px;font-size:28px;font-weight:bold;cursor:pointer;color:#888;line-height:1;}#sn-user-modal-close:hover{color:#000;}";function i(){var e=document.getElementById("sn-user-modal");e&&e.parentNode.removeChild(e)}l.innerHTML="
×
'+t+"
",document.body.appendChild(l),document.getElementById("sn-user-modal-close").addEventListener("click",i),document.getElementById("sn-user-modal-backdrop").addEventListener("click",i)})(); From 57a2d82f7cfadf8623609fc3d3ad7551bc689915 Mon Sep 17 00:00:00 2001 From: JohanDC-1999 <82451675+JohanDC-1999@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:52:41 +0200 Subject: [PATCH 6/6] Update readme.md Added screenshot to show how it looks --- .../Browser Bookmarklets/Show Logged-in User roles/readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md index 685083a3d6..bae3bc13e8 100644 --- a/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md +++ b/Specialized Areas/Browser Bookmarklets/Show Logged-in User roles/readme.md @@ -16,3 +16,6 @@ A simple, client-side bookmarklet to display the current ServiceNow user's detai 4. Paste the code into the **URL** or **Address** field of the bookmark 5. Save the bookmark 6. While on any ServiceNow page, click the bookmark to activate the modal + +image +