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 03:46 AM
hello @Naresh_5120,
https://www.servicenow.com/community/developer-forum/inbound-actions-update-incident-bp-creates-new-...
https://www.servicenow.com/community/developer-forum/inbound-action-updating-incident/m-p/1965886
https://www.servicenow.com/community/developer-forum/how-to-create-inbound-email-action-for-updating...
Thanks
SP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 04:53 AM
@Naresh_5120 Please use the following email script to update an existing incident if the subject carries any incident number.
var regex = /INC[0-9]+/gi
if(regex.test(email.subject)){
//get the match
var matchInc = email.subject.match(regex);
var glideInc = new GlideRecord('incident');
glideInc.addQuery('number',matchInc);
glideInc.setLimit(1);
glideInc.query();
if(glideInc.next()){
//Do something here
gs.info(glideInc.short_description);
}
else{
gs.info('Incident with number '+matchInc+' not found');
}
}
else{
gs.info('Subject does not contain incident number ');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 05:13 AM
Dear @Sandeep Rajput
Thank you for your quick response. I have tried this script but it is creating new incident instead of updating an existing incident. Am I missing something
Do i have to use when to run Type as "None"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 05:47 AM
@Naresh_5120 Ideally, the None type should process all the types (New, Reply and Forward) here is the article https://www.servicenow.com/community/developer-blog/inbound-action-with-type-and-target-table-set-to.... covering the None type usage.
Regarding your issue, did you check if there any existing inbound actions on your incident table which is creating new incident? if yes then try and deactivate them or reduce the order of your current inbound action and set the stop processing checkbox to true so that the other inbound actions will not get processed.