From b35150091bdf7cd070523ec7dd56c68e2c0ca687 Mon Sep 17 00:00:00 2001 From: Code with bhav <92107107+bhavyaa30@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:22:51 +0530 Subject: [PATCH 1/2] script.js --- .../script.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/script.js diff --git a/Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/script.js b/Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/script.js new file mode 100644 index 0000000000..9b8b75a6b6 --- /dev/null +++ b/Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/script.js @@ -0,0 +1,18 @@ +// Get list of selected incident sys_ids from the list +var selected = g_list.getChecked(); // returns array of sys_ids + +if (!selected || selected.length === 0) { + gs.addInfoMessage('No incidents selected.'); +} else { + var userId = gs.getUserID(); // Current user's sys_id + var gr = new GlideRecord('incident'); + + for (var i = 0; i < selected.length; i++) { + if (gr.get(selected[i])) { + gr.assignment_group = ''; // Optional: clear group if needed + gr.assigned_to = userId; // Assign to current user + gr.update(); + } + } + gs.addInfoMessage(selected.length + ' incident(s) assigned to you.'); +} From 2d5e8f0c2237e8682419ea4df8eda189144fd6eb Mon Sep 17 00:00:00 2001 From: Code with bhav <92107107+bhavyaa30@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:25:46 +0530 Subject: [PATCH 2/2] readme.md --- .../readme.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/readme.md diff --git a/Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/readme.md b/Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/readme.md new file mode 100644 index 0000000000..b1251ddb60 --- /dev/null +++ b/Client-Side Components/UI Actions/Bulk Assign Incidents via List Button/readme.md @@ -0,0 +1,33 @@ +## Use Case +In ServiceNow, the default Assign to Me action works only for single records. +We need a list UI Action to allow users to select multiple incidents and assign them all to themselves in one click. +## Implementation Approach +Type: List UI Action +Table: incident +Condition: Active incidents only (optional) +Action: Server-side script using GlideRecord to update selected incidents. +## Code +UI Action Configuration: +Name: Bulk Assign to Me +Table: Incident (incident) +Action Type: List +Form Button: Unchecked +List Button: Checked +Client: False (Server-side) +## Steps to Configure in ServiceNow +Navigate to System Definition → UI Actions. +Click New and fill the fields as per above. +Make List Button = True. +Paste the script into the Script section. +Add roles/conditions if required. +Save and refresh the Incident list. +## How to Use +Go to the Incident list view. +Check multiple incident records. +Click Bulk Assign to Me. +All selected incidents are now assigned to the current user. +A confirmation message shows how many incidents were updated. +## Notes / Best Practices +This is server-side to ensure security and avoid client manipulation. +Can be enhanced to assign to a specific group dynamically. +Works for any list view with sys_ids selected.