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

nearly what you are asking for




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.