From 1e5916c51161daec2f6c179b326fa061c0c6aa02 Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Wed, 22 Oct 2025 23:33:39 +0530 Subject: [PATCH 1/2] Create script.js Inbound action for duplicate incident handling. --- .../script.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/script.js diff --git a/Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/script.js b/Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/script.js new file mode 100644 index 0000000000..5bfc29dd2f --- /dev/null +++ b/Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/script.js @@ -0,0 +1,25 @@ +(function runAction(current, event, email, logger, classifier) { + var subject = email.subject.trim(); + + //Look for duplicate incident + var gr = new GlideRecord('incident'); + gr.addActiveQuery(); + gr.addQuery('short_description', 'CONTAINS', subject); + gr.addQuery('state', 'NOT IN', '3,4'); //Ignore resolved or closed incidents + gr.query(); + + if(gr.next()){ + //Update existing incident with duplicate email + gr.work_notes = 'Duplicate email received for this incident:\n' + email.body_text; + gr.update(); + + //Abort creating new incident + action.setAbortAction(true); + return; + } + + //Create new incident if no duplicate incident found + current.short_description = email.subject; + current.description = email.body_text; + current.update(); +})(current, event, email, logger, classifier); From f5926ba69a7a3c6f73b85b1705c35e12488bc91d Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Wed, 22 Oct 2025 23:38:35 +0530 Subject: [PATCH 2/2] Create README.md --- .../README.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/README.md diff --git a/Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/README.md b/Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/README.md new file mode 100644 index 0000000000..7843a1d4f5 --- /dev/null +++ b/Server-Side Components/Inbound Actions/Duplicate Incident Detection and Creation/README.md @@ -0,0 +1,23 @@ +**Duplicate Incident Detection and Creation** + +**Description** +This inbound email action detects duplicate incidents from incoming emails and either updates existing incidents or creates a new one. + +- Duplicate Found: Updates the existing incident's work notes with the new email content and aborts new incident creation. +- No Duplicate Found: Creates a new incident with the email subject as short description and the email body as description. + +**Use Case** +When multiple users report the same issue via email, this automation prevents duplicate incidents, keeping the incident queue cleaner and improving triage efficiency. + +**Inbound Action Configuration** +- Target Table: incident +- Action Type: Record Action +- Type: New + +**How It Works** +1. The inbound email action scans the email subject for matches against active incidents whose short description contains the subject excluding Closed or Cancelled incidents. +2. If a matching incident is found: + - Updates the incident's work notes with the email content. + - Aborts creation of a new incident. +3. If no match is found: + - Creates a new incident using the email subject as the short description and the email body as the description.