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 1/9] 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 2/9] 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 3/9] 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 4/9] 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 5/9] 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 6/9] 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 7/9] 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 8/9] 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 9/9] 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