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

Ajai S Nair
Giga Guru

Hi Dale,



Create a report with the condition status is not closed in incident table. Then you will be able to see the incidents in state anything other than 'closed'. You can use this same condition in the filter condition in the list view of incidents.



Thanks and Regards,


Ajai


Brad Tilton
ServiceNow Employee
ServiceNow Employee

It depends how you have the list. If you are looking at a list view you can just do this:


4a094321d1.png



If it's in a script you can use a query or if statement to filter out.


dcoyne1
Kilo Explorer

OK,



I'll try and explain this a bit better...



We currently use a monitoring system (nagios) and when incidents are logged for each alert we put a comment on the alert..



Now, we can have the list of 'comments' (INC numbers) exported into a list & we are looking to see if there is a way we can have SNOW check if the incidents are open or not. Rather than one of our analysts having to go into snow and check each individual reference.



Thanks,



Dale.


Hi Dale,



You can create a report by giving the comments and state in the condition and schedule it daily or weekly. So that it will create a list of incidents which are open and you will receive it in your mail.



Thanks and Regards,


Ajai