Update Incident (BP) - How to use this rule to reopen incidents from all e-mail replies

Keisha Holmes
Tera Contributor

Hi, 

 

I am trying to make it so that when any e-mail replies are added to an incident, the incident automatically reopens/moves to work in progress status. Based on the script under the Actions tab in the Update Incident (BP) inbound action, it looks like only replies from the original Requestor/Caller, reopen the incident. 

 

For Example, Becky Sue sends an email to the instance and copies Dave Smith on the e-mail. The Incident is created with Becky Sue as the Requestor/Caller. After the incident has been placed in a pending or resolved status, Dave Smith replies to Becky's original e-mail. The incident is automatically updated with Dave's reply in the work notes/comments section, but the incident does not move to the work in progress status that we would like. But if Becky replies to the original e-mail, the incident will add Becky's email to the work notes/comments section AND move the state to work in progress. 

I have pasted the script below. I believe this line indicates that only the requestor/caller's email replies will reopen the incident: gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;

 

What would I need to add to this line to make it so that any replies re-open the incident? Any feedback is greatly appreciated. 

 

"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;
}
 
if (gr.canWrite())
gr.update();
}"
4 REPLIES 4

Hemanth M1
Giga Sage
Giga Sage

Hi @Keisha Holmes ,

 

Its not restricting based on who sends the email, its restricting wheter sender has access to update the record or not 

line : 

1)

if (gr.canWrite()) //this would check the ACLs if sender has access to update the incident or not
gr.update();
}
 
2)addition to that , subject should contain "please reopen" while sending 
 
Check if Dave Smith has access to update the incident (just by impersonating)
and also to double check this, include your email address(as admin) in the notification and reply to reopen and verify.
 
Below line is to grab who sent the email and email body to update comment :
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
Hope this helps....
 
 
Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi @Keisha Holmes ,

 

Did my response answer u r question if so,

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi Hemanth,

Our end users do not have to include "please reopen" in the subject line. Whenever they respond to an email that corresponds to a specific record, that record is automatically updated with the user's comments. Additionally, if the requestor is the one sending the e-mail, the ticket will automatically move to an In Progress state from an On Hold or Resolved state. Our issue is that only the requestor's e-mails trigger this functionality.

If the person e-mailing is not the requestor, only the comments on the incident are updated and the ticket will not move to an In progress state. 

I did check the ACL and I believe it should be this one for Incident Write that says "Allow write for all fields in incident, for users with role sn_incident_write, and if the ACL condition (incident_stateNOT IN7,8^EQ) evaluates to true."

 

All users currently have the role sn_incident_write but it still isn't working. Will we need a new ACL or am I looking at the wrong ACL possibly?

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Keisha Holmes 

 

I assume it is OOTB available. Hope you check that.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************