From afd4406bdae59b79d510284b29f5205ef4c7a299 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 09:47:04 +0530 Subject: [PATCH 01/14] Create Code.js --- .../code.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /code.js diff --git a/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /code.js b/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /code.js new file mode 100644 index 0000000000..8541d8ed8c --- /dev/null +++ b/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /code.js @@ -0,0 +1,26 @@ +//Business Rule: After update on the incident table +//Condition: Additional comments changes +//Create on global Tag record ex: Comments added + +(function executeRule(current, previous /*null when async*/ ) { + + var caller = current.caller_id.user_name; +// Add tag to the incident record if the comments is updated by the caller + if (current.sys_updated_by == caller) { + var add_tag_entry = new GlideRecord('label_entry'); + add_tag_entry.initialize(); + add_tag_entry.label = ''; + add_tag_entry.table = 'incident'; + add_tag_entry.table_key = current.sys_id; + add_tag_entry.insert(); + } else { +// Remove tag from the incident record if the agent responds back to the caller + var remove_tag_entry = new GlideRecord('label_entry'); + remove_tag_entry.addEncodedQuery("label=^table_key=" + current.sys_id); + remove_tag_entry.query(); + if (remove_tag_entry.next()) { + remove_tag_entry.deleteRecord(); + } + } + +})(current, previous); From 99672a834fdc7c73c1a828df4e39c885e98413f7 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 09:51:01 +0530 Subject: [PATCH 02/14] Create README.md --- .../README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /README.md diff --git a/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /README.md b/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /README.md new file mode 100644 index 0000000000..e027157668 --- /dev/null +++ b/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /README.md @@ -0,0 +1,2 @@ +The purpose of this code is to conditionally apply a specific label (label_entry) to an Incident when the person updating the record is the same as the caller. If the update is made by someone else, the label is removed. +This mechanism helps fulfillers quickly identify caller driven updates, enabling faster and more targeted responses. Additionally, it can be leveraged in reporting to track caller engagement. From 319fcbca634ceb1ee18ad9245ceac16d8851f326 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 09:57:43 +0530 Subject: [PATCH 03/14] Add Business rule: Add or remove tag to the ticket From 00cf6c0c4a929ded556557337723aeedb5431a35 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 10:10:48 +0530 Subject: [PATCH 04/14] Rename code.js to code.js --- .../code.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Server-Side Components/Business Rules/{Add or remove a tag from the ticket whenever the comments are updated => Add or remove a tag from the ticket whenever the comments are updated}/code.js (100%) diff --git a/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /code.js b/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated/code.js similarity index 100% rename from Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /code.js rename to Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated/code.js From b4694abefe2100b682598cc3639ad9ae957066d5 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 10:13:29 +0530 Subject: [PATCH 05/14] Rename README.md to README.md --- .../README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Server-Side Components/Business Rules/{Add or remove a tag from the ticket whenever the comments are updated => Add or remove a tag from the ticket whenever the comments are updated}/README.md (100%) diff --git a/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /README.md b/Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated/README.md similarity index 100% rename from Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated /README.md rename to Server-Side Components/Business Rules/Add or remove a tag from the ticket whenever the comments are updated/README.md From bcba22df8aa61064c18f2197e680a42c7724f148 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 11:09:16 +0530 Subject: [PATCH 06/14] Adding new UI Action: Generate PDF --- .../UI Actions/Generate PDF/Script.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Client-Side Components/UI Actions/Generate PDF/Script.js diff --git a/Client-Side Components/UI Actions/Generate PDF/Script.js b/Client-Side Components/UI Actions/Generate PDF/Script.js new file mode 100644 index 0000000000..5c21ad5786 --- /dev/null +++ b/Client-Side Components/UI Actions/Generate PDF/Script.js @@ -0,0 +1,10 @@ +// UI Action: Generate PDF +// Table: Incident +// Condition: current.state=='6' //Resolved +// Onclick: generatePDF(); +// sysparm_view = pdf_export +function generatePDF() { + + var url = '/'+g_form.getTableName() + '.do?sys_id=' + g_form.getUniqueValue() + '&PDF&sysparm_view=pdf_export'; + top.window.open(url, '_blank'); +} From 72c0986e012ba23dbde31dec1a22d4ed33ec1a07 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 11:10:59 +0530 Subject: [PATCH 07/14] Adding new UI Action: Generate PDF --- Client-Side Components/UI Actions/Generate PDF/README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Client-Side Components/UI Actions/Generate PDF/README.md diff --git a/Client-Side Components/UI Actions/Generate PDF/README.md b/Client-Side Components/UI Actions/Generate PDF/README.md new file mode 100644 index 0000000000..ca87f9f4b6 --- /dev/null +++ b/Client-Side Components/UI Actions/Generate PDF/README.md @@ -0,0 +1,6 @@ +Description: +This UI Action enables users to generate and download the current record in PDF format. It is particularly useful in the Incident table for PIR (Post-Incident Review) documents after resolution. + +Pre-requisite: +A dedicated form view must be created containing all relevant fields such as Resolution Code, Resolution Notes, Assignment Group, Assigned To, and others required for comprehensive reporting. +In this code, I've used the view name called 'pdf_export' which is already created in the Incident table From 5d9c06b7f435d7d8fb5f3871bb2283f99378f09a Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 11:48:56 +0530 Subject: [PATCH 08/14] Adding new Background script: Bulk Update of Fulfillment Group References in Published KB Articles --- .../script.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js diff --git a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js new file mode 100644 index 0000000000..3dce667c12 --- /dev/null +++ b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js @@ -0,0 +1,14 @@ +var old_reference = "Service desk"; // Old group name +var new_reference = "Help desk"; // New group name + +var regexPattern = new RegExp('(?is)'+ old_reference, 'gi'); // Building Regex to generate case-insensitive pattern + +var kb_article = new GlideRecord('kb_knowledge'); +kb_article.addEncodedQuery('workflow_state=published'); +kb_article.query(); +while(kb_article.next()){ + kb_article.text = kb_article.text.replace(regexPattern,new_reference); // Replacing the old group reference with the new group + kb_article.setWorkflow(false); + kb_article.update(); + gs.info('Updated Article: ' + kb_article.number); +} From 6f12dbdcbdbe0d73ef1be041ed60c7352db795ee Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 11:50:01 +0530 Subject: [PATCH 09/14] Adding new Background script: Bulk Update of Fulfillment Group References in Published KB Articles --- .../README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md diff --git a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md new file mode 100644 index 0000000000..7fa02ec5c2 --- /dev/null +++ b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md @@ -0,0 +1,2 @@ +Description: +This background script is used to automatically update the content of all published Knowledge Base articles by replacing outdated group references, ensuring consistency and relevance across documentation without the need to manually check out and edit each article From eec21a3b56c0380342842a7f94ca28c896147752 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:35:34 +0530 Subject: [PATCH 10/14] Delete Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles directory --- .../README.md | 2 -- .../script.js | 14 -------------- 2 files changed, 16 deletions(-) delete mode 100644 Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md delete mode 100644 Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js diff --git a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md deleted file mode 100644 index 7fa02ec5c2..0000000000 --- a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Description: -This background script is used to automatically update the content of all published Knowledge Base articles by replacing outdated group references, ensuring consistency and relevance across documentation without the need to manually check out and edit each article diff --git a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js deleted file mode 100644 index 3dce667c12..0000000000 --- a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js +++ /dev/null @@ -1,14 +0,0 @@ -var old_reference = "Service desk"; // Old group name -var new_reference = "Help desk"; // New group name - -var regexPattern = new RegExp('(?is)'+ old_reference, 'gi'); // Building Regex to generate case-insensitive pattern - -var kb_article = new GlideRecord('kb_knowledge'); -kb_article.addEncodedQuery('workflow_state=published'); -kb_article.query(); -while(kb_article.next()){ - kb_article.text = kb_article.text.replace(regexPattern,new_reference); // Replacing the old group reference with the new group - kb_article.setWorkflow(false); - kb_article.update(); - gs.info('Updated Article: ' + kb_article.number); -} From fe53f5778eb645633cdec3a536c3a3aca7c9e6b9 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:54:56 +0530 Subject: [PATCH 11/14] Adding new BG script: Bulk Update of Fulfillment Group References in Published KB Articles --- .../script.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js diff --git a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js new file mode 100644 index 0000000000..3dce667c12 --- /dev/null +++ b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/script.js @@ -0,0 +1,14 @@ +var old_reference = "Service desk"; // Old group name +var new_reference = "Help desk"; // New group name + +var regexPattern = new RegExp('(?is)'+ old_reference, 'gi'); // Building Regex to generate case-insensitive pattern + +var kb_article = new GlideRecord('kb_knowledge'); +kb_article.addEncodedQuery('workflow_state=published'); +kb_article.query(); +while(kb_article.next()){ + kb_article.text = kb_article.text.replace(regexPattern,new_reference); // Replacing the old group reference with the new group + kb_article.setWorkflow(false); + kb_article.update(); + gs.info('Updated Article: ' + kb_article.number); +} From 735eea612cc8de7fb41eb339d15807dab815c1c3 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:55:52 +0530 Subject: [PATCH 12/14] Create README.md --- .../README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md diff --git a/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md new file mode 100644 index 0000000000..7fa02ec5c2 --- /dev/null +++ b/Server-Side Components/Background Scripts/Bulk Update of Fulfillment Group References in Published KB Articles/README.md @@ -0,0 +1,2 @@ +Description: +This background script is used to automatically update the content of all published Knowledge Base articles by replacing outdated group references, ensuring consistency and relevance across documentation without the need to manually check out and edit each article From a1cc0b528a27e19ba0137f6c998b4ec421cbe63a Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:58:10 +0530 Subject: [PATCH 13/14] Delete Client-Side Components/UI Actions/Generate PDF/README.md --- Client-Side Components/UI Actions/Generate PDF/README.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 Client-Side Components/UI Actions/Generate PDF/README.md diff --git a/Client-Side Components/UI Actions/Generate PDF/README.md b/Client-Side Components/UI Actions/Generate PDF/README.md deleted file mode 100644 index ca87f9f4b6..0000000000 --- a/Client-Side Components/UI Actions/Generate PDF/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Description: -This UI Action enables users to generate and download the current record in PDF format. It is particularly useful in the Incident table for PIR (Post-Incident Review) documents after resolution. - -Pre-requisite: -A dedicated form view must be created containing all relevant fields such as Resolution Code, Resolution Notes, Assignment Group, Assigned To, and others required for comprehensive reporting. -In this code, I've used the view name called 'pdf_export' which is already created in the Incident table From bc57d509016638aa0b6108230584037d2d7787e4 Mon Sep 17 00:00:00 2001 From: SIVAMURUGANANDAM J <67639018+sivamuruganandam-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:58:27 +0530 Subject: [PATCH 14/14] Delete Client-Side Components/UI Actions/Generate PDF/Script.js --- .../UI Actions/Generate PDF/Script.js | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 Client-Side Components/UI Actions/Generate PDF/Script.js diff --git a/Client-Side Components/UI Actions/Generate PDF/Script.js b/Client-Side Components/UI Actions/Generate PDF/Script.js deleted file mode 100644 index 5c21ad5786..0000000000 --- a/Client-Side Components/UI Actions/Generate PDF/Script.js +++ /dev/null @@ -1,10 +0,0 @@ -// UI Action: Generate PDF -// Table: Incident -// Condition: current.state=='6' //Resolved -// Onclick: generatePDF(); -// sysparm_view = pdf_export -function generatePDF() { - - var url = '/'+g_form.getTableName() + '.do?sys_id=' + g_form.getUniqueValue() + '&PDF&sysparm_view=pdf_export'; - top.window.open(url, '_blank'); -}