Inbound Action - Prevent the creation of multiple tickets from alerts with the same subject

MarkJustinC6114
Tera Contributor

We are receiving multiple alerts with the same subject within a single day. We would like to prevent the creation of duplicate tickets when multiple alerts have the same subject.

2 REPLIES 2

vijaydodla
Giga Guru

Can you give more details . Sample Events and also is this ITOM related events ?

Vishal Jaswal
Tera Sage

Hello @MarkJustinC6114 

I would encourage you to submit this as an idea to ServiceNow so that they include such logic in their Out-of-the-box (oob) "Create Incident" Inbound e-mail action.

Usually when multiple alerts are received then they do have different timestamp however it is the subject according to you which defines duplicate, then it will be easy for you to stop processing your email inbound action further.

For example: Below is the oob inbound action whose code can be updated in the beginning to first gliderecord the incident table to query short_description (if it is your subject) with alert subject including Active Query:

var existingInc = new GlideRecord('incident');
existingInc.addQuery('short_description', email.subject);
existingInc.addActiveQuery();
existingInc.orderByDesc('sys_created_on');
existingInc.setLimit(1);
existingInc.query();
if (existingInc.next()) {
existingInc.comments ="Duplicate email received from: " + email.origemail +"\n\n" + email.body_text;
existingInc.update(); 

} else { //remaining code of existing oob Create Incident Inbound action

VishalJaswal_0-1790701640255.png

 





Hope that helps!