How to close/resolve an incident using an inbound email

SamuelNjeri
Tera Contributor

Hello Team,

Has anybody achieved closing/resolving an incident from inbound email which is separate and dont have a common link to the 1st email.

The system generate an initial email for an alert then generate anohter separate email for alert clearance. There is no event ID and would like to use maybe the subject to search the incident created so that the 2nd email can resolve it.

 

Thanks

 

5 REPLIES 5

Ajay_Chavan
Kilo Sage

@SamuelNjeri 


lets consider keyword is in subject : 

Parse subject for unique identifier

var subject = email.subject;
var identifier = subject.substring(subject.indexOf("identifier:"), subject.length);

Now query the incident table with the identifier:

// Query incident table

var gr = new GlideRecord('incident');
gr.addQuery('short_description', 'CONTAINS', identifier); // or use custom field
gr.addQuery('active', true);
gr.query();

if (gr.next()) {
gr.state = 6; // Resolved
gr.close_code = 'Solved ';
gr.close_notes = 'Auto-resolved from email';
gr.update();
}

 

Refer:

Update incident without watermark: https://www.servicenow.com/community/servicenow-ai-platform-forum/update-incident-from-email-with-no...

 

Ajay_Chavan_0-1767064567630.png

 

 

Glad I could help! If this solved your issue, please mark it as Helpful and Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****