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/5] 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/5] 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/5] 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/5] 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/5] 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