- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 03:24 AM
Hy!
So whenever an incident is closed, and a client replies to it via email, we would like it to automatically open again ( so the state of the incident should change from closed to active ( in progress)
So if the customer is replying to a ticket that is closed (the subject contains the reference id of the ticket) the comment gets posted into the ticket, but I would like it to be automatically reopened the ticket.
Can someone help me on this subject? What do I need to do in order to get the desired workflow?
Thanks in advanced!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 03:43 AM
Hi,
set a condition to the "Update Incident" Inbound action to create a new Incident in case of the current one being already closed.
gs.include('validators');
if (current.getTableName() == "incident") {
var gr = current;
if(gr.state ==3 || gr.state==4){ //considering 3 is closed & 4 is closed complete
gs.eventQueue("incident.Closed", gr, gr.state, previous.state);
var ni = new GlideRecord('incident');
ni.initialize();
ni.caller_id = email.from_sys_id;
ni.description = email.body;
ni.short_description = email.subject;
ni.incident_state = IncidentState.NEW;
ni.notify = 2;
ni.contact_type = "email";
if (email.body.assign != undefined)
ni.assigned_to = email.body.assign;
if (email.importance != undefined) {
if (email.importance.toLowerCase() == "high")
ni.priority = 1;
}
if (email.body.priority != undefined)
ni.priority = email.body.priority;
ni.insert();
}
else{
if (email.subject.toLowerCase().indexOf("please reopen") >= 0 && gr.state != 0)
gr = new Incident().reopen(gr, email) || gr;
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
gr.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
gr.priority = email.body.priority;
}
gr.update();
}
}
Please try this code.
Please mark correct or helpful based on the impact.
Regards,
Aniket Sawant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 03:43 AM
Hi,
set a condition to the "Update Incident" Inbound action to create a new Incident in case of the current one being already closed.
gs.include('validators');
if (current.getTableName() == "incident") {
var gr = current;
if(gr.state ==3 || gr.state==4){ //considering 3 is closed & 4 is closed complete
gs.eventQueue("incident.Closed", gr, gr.state, previous.state);
var ni = new GlideRecord('incident');
ni.initialize();
ni.caller_id = email.from_sys_id;
ni.description = email.body;
ni.short_description = email.subject;
ni.incident_state = IncidentState.NEW;
ni.notify = 2;
ni.contact_type = "email";
if (email.body.assign != undefined)
ni.assigned_to = email.body.assign;
if (email.importance != undefined) {
if (email.importance.toLowerCase() == "high")
ni.priority = 1;
}
if (email.body.priority != undefined)
ni.priority = email.body.priority;
ni.insert();
}
else{
if (email.subject.toLowerCase().indexOf("please reopen") >= 0 && gr.state != 0)
gr = new Incident().reopen(gr, email) || gr;
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
gr.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
gr.priority = email.body.priority;
}
gr.update();
}
}
Please try this code.
Please mark correct or helpful based on the impact.
Regards,
Aniket Sawant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 02:18 AM
Hy Aniket, thank you for you response! Is there any way doing this without opening a new incident? So only open the old incident and that is it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 03:22 AM
Hi,
It is not best practice to reopen incident according to process of itil. It is better to create a new incident for the same issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 07:21 AM
i have seen this in one account and it created lot of problems.
Sometimes clients replied with comments like thank you and it reopened the ticket.
But yes it was implemented to reopen the ticket from Resolved state.
Opening a ticket from closed is ITIL violation.
ServiceNow Community Rising Star 2022/2023