Wednesday, July 25, 2012

SCSM 2012: Notify "Assigned To" User When An End-User Comment Is Added To An Incident

Hello, I want to start off by letting you know that this is my first attempt at a blog, of any kind.  Knowing that along with the fact that my full-time job is managing a global service desk and not deploying or customizing SCSM for a living, try to bare with me as I get my feet wet.

A common question that I have seen in forums and other blogs is, "How do I actively notify the analyst responsible for an incident when a end-user adds a comment either via the SMPortal or email?".  

The answer is that there are a couple of ways to do this and several people have blogged about it but so far everything I have found refers to a solution for SCSM 2010 which required importing a custom workflow as described in
this blog by Marcel Zehner.

However, that workflow is no longer need in SCSM 2012 now that the "Trouble Ticket User Comments" and "Trouble Ticket Analyst Comments" classes have been made available to the Templates and Subscriptions wizards.  (I actually never used SCSM 2010 so I don't know if these classes were available in that release or not.)

The steps below show you how I answered this question and send email notifications to my analysts when an end-user comment is added to an incident.  The same general process can be followed to send notifications to the Assigned To user when an analyst adds a comment or it could be modified slightly to instead send the email to the Affected User.  The only difference would be to select the "Trouble Ticket Analyst Comments" class instead of "Trouble Ticket User Comments" when setting up the Template and Subscription as described below.

1)  Under Administration > Notifications > Templates select the task to Create E-mail Template. In the General section of the wizard enter the notification template name and optional description then select Trouble Ticket User Comments from the All basic classes list for your targeted Class.  Save this template to a custom management pack.

The General section should look something like this.

Now you can design your actual email template.

2)  In my notification email I wanted to include the text of the comment, who it was entered by, and when it was entered.  Since those are properties of the targeted class they are easily added to the email by clicking the Insert button and adding the Comment, Entered by, and Entered date properties under Work Item Comments Log.

Now you have the comment, who entered it and when in your email template but knowing those three things doesn't really help if you don't know what incident the comment was entered for.

3)  To help the analyst quickly identify what incident this comment was entered for I needed to add the incident ID and/or Title, I decided to add both.  To add the incident ID click the Insert button again and this time select Has User Comment in the Related classes section then enter "ID" in the Available properties search field to filter the list.  Several properties will be listed, scroll to the bottom of the list and add the ID property under Work Item.  To add the incident title to your email repeat this step but add the Title property under Work Item instead.

In my environment I chose to send my emails as HTML but that is not required for this template to work.  After all of your text and properties have been added your email template should look something like this.

4)  Now that your email template has been created it is time to create the subscription that will trigger the email.  Go to the Subscriptions view and click the Create Subscription task.  Enter the name and option description then select "When an object of the selected class is created" for the When to notify setting.  Just like the e-mail template, select the Trouble Ticket User Comments as the Targeted class and your custom management pack.

Don't select anything under the optional Additional Criteria, unless you want to.  In the Template section select the e-mail template you just created.

5)  In my environment I only wanted the recipient of this notification to be the Assigned To user of the incident so I left the Recipient section blank but added the Assigned To User property of the [Trouble Ticket] Has User Comment class to the Related Recipients section.

6) Save your subscription and that's it!  Any time a comment is entered either via the SMPortal or via the Exchange Connector the analyst assigned to the incident should be notified.