I'm looking to find a way to have SNOW automatically check if tickets are active/closed.

dcoyne1
Kilo Explorer

If i give the system a list of INC's is there a way to have it check if they are "anything other than 'Closed'" or "closed".

1 ACCEPTED SOLUTION

This is how you can do it:



1. create an event called "u.nagios.incident.report" in the Event Registry



2. an Inbound Email Action that reads your incoming email.   It's real simple, just firing an event with the Incident #s as a parameter and, if you have the "Ordered Email Processing" plugin installed, will stop further processing of the email:



Condition:   email.subject.toLowerCase().indexOf("nagios incident report") > -1


Script:


(function(){


  gs.eventQueue("u.nagios.incident.report", null, email.body_text, "");


  event.state="stop_processing";


})();




3. an Email Notification that reports back on their status.   It is a simple mail_script block that queries the Incidents (it assumes you are sending the Incident #'s in a comma separated format in the email message [eg. INC0000048,INC0000049])


<mail_script>


  var gr = new GlideRecord("incident");


  gr.addEncodedQuery("numberIN" + event.parm1);


  gr.query();


  while (gr.next()) {


  template.print(gr.getValue("number") + " - " + gr.getDisplayValue("state") + "<br/>");


  }


</mail_script>



You can obviously add whatever you need to the notification to pretty it up.



That will basically do the work for you, although you may have to tweak a few things to work in your particular environment.   I've attached XML files of the 3 records you need if you want to import and play around with the solution.


View solution in original post

11 REPLIES 11

Open the table. Do filter like


Number is one of, with the numbers from list and state not in closed.


and is there no way to automate this?


You sure can, but I'm not 100% sure on what you mean by "automate".   Couple questions for you:


  • what is the outcome you are looking for?   An email to a group of people with the results?
  • can you send an email to ServiceNow with the list of Incidents you want to check?


If the answers to both are "yes", then I would suggest creating an Inbound Email action that would read your email with the Incidents and then kick off a reply notification with the results.



Let me know if that is the sort of result you are looking for and I can help you set it up.   Or are you looking for something within the tool itself?


This could be just the ticket Jim!



If i can find a way to have the nagios comments (INC's) emailed to Service Now the way you have detailed in the above it may be just the thing we are looking for.



And yes the email back from service now would say something like:



"all incidents active"



OR



"INCxxxx state is closed"



OR even



"INCxxx - Active


INCxxx - Closed


INCxxx - Pending etc."