Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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);
Loading