Email from the same sender and subject to ServiceNow (60-minute window)

MarkT2445801916
Tera Contributor

Does anyone know how to configure (inbound email actions?)  setup ServiceNow to send all emails with the same sender and subject over a 60-minute window to a single ticket instead of creating multiple tickets?  For example, email 1 creates a ticket and as long as tickets 2 through ? have the same sender and subject they get appended to the ticket created by the first email. Note:  These would not be replies to the original email where the Incident identifier is in the subject or body of the message. 

1 ACCEPTED SOLUTION

Hemanth M1
Giga Sage
Giga Sage

Hi @MarkT2445801916 ,

 

Can you try this in your inbound script to check if any incidents exist for this sender, assuming the short description is the email subject, created in the last hour, and the record is active

 

var checkRecord = new GlideRecord("incident");
checkRecord.addEncodedQuery("caller_id=" + gs.getUserID() + "^short_description=" + email.subject + "^sys_created_onONLast hour@javascript:gs.beginningOfLastHour()@javascript:gs.endOfLastHour()^active=true");
checkRecord.query();
if (checkRecord.next()) {
    //update the existing incident
    checkRecord.comments = email.body_text;
    checkRecord.update();
} else {
    //create new incident
}

 

Hope this helps!!!

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

1 REPLY 1

Hemanth M1
Giga Sage
Giga Sage

Hi @MarkT2445801916 ,

 

Can you try this in your inbound script to check if any incidents exist for this sender, assuming the short description is the email subject, created in the last hour, and the record is active

 

var checkRecord = new GlideRecord("incident");
checkRecord.addEncodedQuery("caller_id=" + gs.getUserID() + "^short_description=" + email.subject + "^sys_created_onONLast hour@javascript:gs.beginningOfLastHour()@javascript:gs.endOfLastHour()^active=true");
checkRecord.query();
if (checkRecord.next()) {
    //update the existing incident
    checkRecord.comments = email.body_text;
    checkRecord.update();
} else {
    //create new incident
}

 

Hope this helps!!!

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025