- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 11:36 AM
From everything I've been able to find, OOB when someone replies to a closed incident email, it should not allow a comment to be made on the incident.
However, in my instance, people can reply to a closed incident email notification and it updates the incident with a comment and also sends both the user and whoever is assigned to the incident an update email.
I've been looking for the solution and I just can't seem to find out what is causing this behavior. Does anyone have any advice on where I should be looking to prevent the comment from being added to the incident? I would like the OOB functionality (unless that's changed in Rome?): someone replies to closed notification and it prevents the comment from being added and does not notify the assigned person.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 12:08 PM
Put it before the line gr.comments S
o it would be like below format open before gr.comment and close after gr.comment
If(gr.state!=7)
{
The line with gr.comments
}
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 11:53 AM
Hello
This is controlled by inbound action named Update incident bp
Just go to that inbound action and before the comment update line write a if logic that gr.state!=7 only then it goes to update incident
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 12:02 PM
Would you mind showing where to put that if statement? I'm very new to both ServiceNow and Javascript...learning as I go.
gs.include('validators');
if (current.getTableName() == "incident") {
var gr = current;
if (email.subject.toLowerCase().indexOf("please reopen") >= 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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 12:08 PM
Put it before the line gr.comments S
o it would be like below format open before gr.comment and close after gr.comment
If(gr.state!=7)
{
The line with gr.comments
}
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 12:22 PM
Like this?
gs.include('validators');
if (current.getTableName() == "incident") {
var gr = current;
if (email.subject.toLowerCase().indexOf("please reopen") >= 0)
gr = new Incident().reopen(gr, email) || gr;
if (gr.state != 7) {
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();
}