How to update existing incident ticket using inbound email action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2024 02:42 PM
Hi Team ,
Am using below code to update the existing incident records using inbound email action ,instead of updating ,service now creating a new incident .below is my code
var caseGR = new GlideRecord(‘incident’);
var Number = emailBody.incident_ticket;
caseGR.addQuery('number', Number);
caseGR.query();
if (caseGR.next()) {
current.state = 10;
current.description='Reopen ticket';
current.update();
}
am trying to use current.update(); instead of caseGR.update(); because I want to capture email in activity log (incident )
Please guide me with best practices

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 07:58 AM
For anyone else landing here from searching, switching current to the record you want should cause the email to attach to it in the activity log:
if (caseGr.next()) {
...
caseGr.update();
current.get(caseGr.sys_id); // Switch current so the email is attached to it
}