How to update the existing ticket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:01 AM
Hello All,
I have created an inbound action to create an Incident and update the incident ticket. Is there any way I can update the existing incident if you find the ticket with the same short description?
When I send an email to Sericenow it's creating new ticket but it is not updating if the short description is found instead it is creating a new ticket again. Please help me.
Below is my piece of code.
var target = new GlideRecord('incident');
target.addQuery('active', true);
target.addQuery('short_description', email.subject);
target.query();
if (target.next()) {
current.caller_id = gs.getUserID();
current.short_description = email.subject;
gs.log(gr.getRowCount() + ' Incidents found - Update ');
current.category = "Application";
current.update();
} else {
current.caller_id = gs.getUserID();
current.short_description = email.subject;
current.description = email.body_text;
gs.log('No Incidents found Insert -----');
current.category = "Database";
current.insert();
}
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:42 AM
1.In "sys_email" table and check the "Reply type" of your email, it should be a reply.
2.Also is your inbound action "reply type".
3. In "sys_email" table, when you will open the email record, the related list will show all the inbound actions skipped or executed, it can tell you if your email is being treated as new.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023