How do I reset closure codes and notes on Incident reopen?

mattweinell
Kilo Explorer

Hello all!

I was recently made a ServiceNow administrator and am very new to the program. Our instance is slowly taking its proper shape as our operators become familiar with the program so we are paying more and more attention to customizable and scriptable aspects of the program.

Recently it was brought to my attention that when an Incident is reopened, the close code and close notes do not return to their default state so when the Incident is closed again (we are circumventing the 'Resolved' state at the moment but will institute it at a later date) it uses the original close code and close notes.

Is there a way, upon Incident reopening, to move the current close notes to a work notes entry and reset the closure information fields to their default state?

-Matt

1 ACCEPTED SOLUTION

Oops, you're right. This should work:



current.state.changes() && previous.state == 3


View solution in original post

9 REPLIES 9

I may have spoken too soon. I tried to create this rule but it won't run and, frankly, I'm too new at this to troubleshoot it. Here is the script that I wrote (close value is 6 in our instance):



if ( current.state.changes() && previous.state == 6 )


{


current.work_notes = "Close code: " + current.close_code + "\nClose notes: " + current.close_notes;


current.close_code = "";


current.close_notes = "";


}



I tried to use the built in filters ("When to run" tab) and set the filter to:



Incident State | Changes <and>
Incident State | Changes from | Closed



But that did not work either.


Could you post a screenshot of the business rule? Is it running Before Update?


Top section is "When to run" and bottom section is "Advanced".



Rule.jpg


I would move the code out of the if statement into the condition and then try adding a log statement to see if this is even running. Everything looks ok to me.


Something we look for our Incidents if they change from Resolved to active again. Aha got it working now. Thanks !