Social

fredag den 22. februar 2013

Auto-resolve inactive incidents with a specific status

Anders Bengtsson has provided a solution for auto-closing incidents in Service Manager. The solution works well for closing a resolved incident, as one would normally not wish to inform the Affected User that the incident has been closed.

In our system when an analyst inquires the Affected User for additional information on an incident the status of the incident changes to "Pending user response" which is filtered out in most of our incident views (out of sight, out of mind). We also decided that these incidents should automatically resolve after 5 days if we did not get a response from the Affected User. The above mentioned solution could do this with a minor change to the code, but as most email-templates would use the ResolutionDescription to inform the user why the incident was resolved, these would now provide no information in that regard.

The following Powershell-script solves this. I am in no way a PS-expert, and I did borrow pieces of code in various places (my apologies for not giving credit where credit is due). I did borrow code fromhere which helped me update multiple properties (Status & ResolutionDescription) in an incident.

Possible drawback: as the criteria is based on LastModified, analysts logging a comment (ex. Called Anne's office, but no answer) or other activity on the incident would prolong the period it could stay in "Pending user response". A way to get around this would be to extend the incident with a field like "PendingUserResponseSinceDate" just like Service Requests has a "CompletedDate", and test on this instead. As we are using the SendMail plugin (which extends the incident with Message and MessageType), I did not use this solution.