How to update an existing incident using inbound email action if existing incident mentioned in subj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 03:42 AM - edited 04-01-2024 04:36 AM
Dear community,
I am looking for solution to update the existing incident (work notes) using inbound email action if an existing incident mentioned in subject line of an email (It could be New, reply or forward email )
Regards,
Naresh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 06:39 AM
Hi @Naresh_5120 ,
Create a script to parse incoming email subject, extract incident number, query Incident table in ServiceNow, and update corresponding incident record with information from email body.
// Parse email subject to extract incident number
var incidentNumber = email.subject.match(/\bINC\d+\b/)[0];
// Query Incident table to find the incident record
var grIncident = new GlideRecord('incident');
if (grIncident.get('number', incidentNumber)) {
// Update the incident record
grIncident.short_description = email.body_text; // Update with email body content
grIncident.update();
}
Please mark this response as helpful if your question has been answered
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 01:10 AM
Dear @Dipen Wadhwana ,
Thank you so much for this script its working perfectly fine, but i have one challenge is, besides updating existing incident record, it is also creating new incident. How can I modify the existing inbound action (to create new incident) to see that if incident is already exist in ServiceNow , it should not create a incident just update the existing incident.