stop duplicate emails from inbound action

JagjeetSingh
Kilo Sage
Kilo Sage

hi,

i have an inbound action to create incidents from email.

The requirement is that i want to ignore incident creation if subject is same and add that mail content in existing incident itself.

Please let me know if any idea on this.

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023
1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hi jagjeet,

Assuming subject is stored in short description of incident.

in your inbound action, check like this. This way, if short description exists already for any incident, then it will update the same incident. otherwise, it will create any new incident.

var gr = new GlideRecord("incident");
gr.addQuery("short_description",email.subject.toString());
gr.query();
if(gr.next()) {
gr.work_notes=email.body_text;
gr.update();
}else {
current.short_description = email.subject;
current.description=email.body_text;
//add other fields here.
}

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

View solution in original post

12 REPLIES 12

Hey Alok, 

Good points. My script is only the starting point to create/update incident. We can add as many conditions as possible in that script based on the business needs.

Hi Alok,

The below script is creating duplicates. Can you please check the script and help me?

find_real_file.png

GMunee
Tera Contributor

Helpful thread.