Inbound Action - Preventing ticket creation for duplicate emails received
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2010 05:42 AM
I am trying to find out how I could prevent a ticket's creation for duplicate emails received. We only have one inbound action that will create a new incident when a email is received from a certain email address (a server) with a specific subject/body. The problem is that sometimes we receive 2-3 duplicate emails milliseconds (possibly seconds) apart from each other from this certain email address (a server) which would cause a ticket to be created for each email.
I would like to prevent a duplicate ticket from being created if there is already one that was just opened. Any help would be greatly appreciated
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2011 10:45 AM
I was wondering if there was a way to do this also. We have incidents come in that are auto generated from our Network provider, and they create a new auto-generated incident every time they are created. These incoming incidents have the same vendor ticket number attached to them, and there are times when we will get up to 5 new Service-Now incidents for the same issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2011 04:30 PM
My assumption would be that each of these subject lines would be exactly the same. If you know your "duplicate" window, as you said you did, "milliseconds, or seconds", you could create a GlideRecord query, in the inbound email action, on the incident table to find any incidents created with the exact same subject line and evaluate the created time. If it was created in the last couple minutes, return out of the function and not create the incident.
maybe something like this...
var inc = new GlideRecord('incident');
inc.addActiveQuery(); // queries active incidents
inc.addQuery('short_description',email.subject); // queries the short_description to be the same as the email subject.
inc.query();
while (inc.next()) {
var created = inc.sys_created_on;
//then evaluate the time here. and return if the condition does not match
}
One issue that you may have to play with is that inbound emails do not get created instantaneously. Sometimes there is a short delay, so your time period may need to be tested and/or varied. Hopefully this idea helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2011 05:13 AM
I was able to get help from SN with this one. Here is the query that we use
var skipmsg = false;
var subject = email.subject;
var body = email.body_text;
var sess = email.body.session_id;
var status1 = email.body.status;
var spec = email.body.specification;
var i_userid = email.from;
gs.log("Checking incident for description containing " + sess);
var target = new GlideRecord('incident');
target.addActiveQuery();
target.addQuery('description', 'CONTAINS', sess);
target.query(); // Issue the query to the database to get relevant records
//if description already exist containing Session ID (emailbody.session_id), do not create ticket
if (target.hasNext()) {
gs.log("Incident " + target.number + " found with same session id (" + sess + ")");
return;
}
// If ticket does not exist, do the following code......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2011 10:22 AM
has anyone tried this code yet?