Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to prevent replies to closed ticket email from adding a comment

Staxed
Tera Guru

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.

1 ACCEPTED SOLUTION

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

View solution in original post

7 REPLIES 7

Yes

This sould do the trick

Please mark answer correct/helpful based on impact

Sushma R1
Tera Expert
Add an additional condition to exclude state closed in your update incident inbound action :) This should solve Hit helpful if it was 🙂

Sushma R1
Tera Expert
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(); }