- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2017 03:44 AM
Hi all,
When we first implemented ServiceNow we were under the impression that when an incident goes from a Resolved state to Closed it could no longer be re-opened by the users clicking the link that emails the instance with a subject of "please reopen". It turns out this isn't the case though as we've had incidents that have been resolved for about 5 months being re-opened. What would I change in the script to stop this happening and only re-open stuff that is set as resolved.
Currently looking at the inbound email action "Update Incident (BP)", looking at the code I think I need to add something into the section "if (email.subject.toLowerCase().indexOf("please reopen") >= 0) {" but I'm not sure what I should be adding there to change the functionality. Complete code posted below...
gs.include('validators');
if (current.getTableName() == "incident") {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (email.subject.toLowerCase().indexOf("please reopen") >= 0) {
current.state = "2";
current.work_notes = "The caller did not feel that this issue was resolved";
}
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}
current.update();
}
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2017 03:46 AM
Hi James,
You can add these lines and test it out once
if (email.subject.toLowerCase().indexOf("please reopen") >= 0 && current.state !=3 ) {
current.state = "2";
current.work_notes = "The caller did not feel that this issue was resolved";
}
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2017 03:46 AM
Hi James,
You can add these lines and test it out once
if (email.subject.toLowerCase().indexOf("please reopen") >= 0 && current.state !=3 ) {
current.state = "2";
current.work_notes = "The caller did not feel that this issue was resolved";
}
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2017 03:47 AM
The email will reopen the incident only when email subject has the phrase please reopen and the state of incident is not Closed (current.state !=3)
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2017 05:12 AM
That did the trick. Knew it was going to be something simple like that I just wasn't sure what to add on. Thanks for your quick response!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 01:08 PM
I am on Xanadu! I am looking at (Update Incident BP) Inbound action and have added the code snippet. It appears there were changes and this no longer works as expected in my environments. Is anyone else having this issue? If so how did or do you resolve this?
Xanadu inbound action code snippet OOB
Thank you in advance!