Archive for: ‘March 2012’

Notify Assigned to when the Affected User updates an incident from the SSP in SCSM 2012

March 30, 2012 Posted by Stefan Allansson

There are already some great blogs about how to notify the “assigned to” user when an incident is updated by the affected user. Those explains how to do this with the Exchange connector or with the SSP for SCSM 2010.

The solution for the Exchange connector also works in SCSM 2012, but since there are a new SSP in 2012 we have to find another way to do it for the SSP.

In SCSM 2012 there is a field for user input and a button “Update request” for the affected user of an incident on the SSP. If the user updates the incident from the SSP, an entry will be added in the action log for that incident.


So to be able to notify the assigned to user that the incident is updated, we need to trigger on when a new End-User comment is added in the action log. To do that we have to create a relationship subscription in XML.
Thanks to Travis that has wrote this blog that describes how to do that: http://blogs.technet.com/b/servicemanager/archive/2010/08/30/notifying-the-affected-user-when-the-analyst-has-updated-the-action-log.aspx

To get this to work for the SSP I used the management pack that Travis have created and made some changes.
In the subscription I changed RelType from WorkItem!System.WorkItem.TroubleTicketHasAnalystComment to WorkItem!System.WorkItem.TroubleTicketHasUserComment and for TargetType I changed from WorkItem!System.WorkItem.TroubleTicket.AnalystCommentLog to System.WorkItem.TroubleTicket.UserCommentLog

I also made changes to the WriteActions. Instead of adding a notification template and a user to notify directly in the XML, I add an incident template that I have created. The only thing my template does is that it sets the UpdatedByEndUser to true.
There is a great blog from my colleague Anders Asp “A smarter way to notify the assignee when the affected user updates his incident” that describes the UpdatedByEndUser solution. http://www.scsm.se/?p=564

So when we add a template that changes the UpdatedByEndUser to true, and have configured the rest in Anders solution it will send an e-mail to the assigned to user.

Below is the management pack that I have used.
You need to change the GUID (A035C6E5-2ADA-334A-3D01-24F4398A5BB1) for the incident template to the GUID of the template that you want to use.
To get the GUID for your template, login in to your SQL Server and run this query against the ServiceManager database.(put in the display name of your template)

“select Objecttemplateid from ObjectTemplate where ObjectTemplateName=’DisplayNameOfYourTemplate’

<ManagementPack ContentReadable=”true” SchemaVersion=”2.0″ OriginalSchemaVersion=”1.1″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>

<Manifest>
<Identity>
<ID>ActionLogAddRelationshipSubscription</ID>
<Version>1.0.0.0</Version>
</Identity>
<Name>Action Log Add Relationship Subscription</Name>
<References>
<Reference Alias=”Console”>
<ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
<Version>7.0.5826.859</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias=”NotificationsLibrary”>
<ID>System.Notifications.Library</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias=”WorkItem”>
<ID>System.WorkItem.Library</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias=”ServiceManager.IncidentLibrary”>
<ID>ServiceManager.IncidentManagement.Library</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias=”System”>
<ID>System.Library</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias=”IncidentLibrary”>
<ID>System.WorkItem.Incident.Library</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias=”Subscriptions”>
<ID>Microsoft.SystemCenter.Subscriptions</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias=”Administration”>
<ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>
<Version>7.0.5826.859</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
</References>
</Manifest>
<Categories>
<Category ID=”Category.ActionLogAddRelationshipSubscriptions.ManagementPack” Value=”Console!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack”>
<ManagementPackName>ActionLogAddRelationshipSubscription</ManagementPackName>
<ManagementPackVersion>7.0.5826.0</ManagementPackVersion>
</Category>
<Category ID=”Category.ActionLogAddRelationshipSubscriptionRule” Target=”ActionLogAddRelationshipSubscriptionRule” Value=”Administration!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions” />
</Categories>
<Monitoring>
<Rules>
<Rule ID=”ActionLogAddRelationshipSubscriptionRule” Enabled=”true” Target=”ServiceManager.IncidentLibrary!System.WorkItem.Incident.WorkflowTarget” ConfirmDelivery=”true” Remotable=”true” Priority=”Normal” DiscardLevel=”100″>
<Category>System</Category>
<DataSources>
<DataSource ID=”DS” TypeID=”Subscriptions!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule”>
<Subscription>
<RelationshipSubscription RelType=”$MPElement[Name=’WorkItem!System.WorkItem.TroubleTicketHasUserComment’]$” SourceType=”$MPElement[Name=’WorkItem!System.WorkItem.TroubleTicket’]$” TargetType=”$MPElement[Name=’WorkItem!System.WorkItem.TroubleTicket.UserCommentLog’]$”>
<AddRelationship />
</RelationshipSubscription>
<PollingIntervalInSeconds>30</PollingIntervalInSeconds>
<BatchSize>100</BatchSize>
</Subscription>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID=”WA” TypeID=”Subscriptions!Microsoft.EnterpriseManagement.SystemCenter.Subscription.WindowsWorkflowTaskWriteAction”>
<Subscription>
<EnableBatchProcessing>true</EnableBatchProcessing>
<WindowsWorkflowConfiguration>                <AssemblyName>Microsoft.EnterpriseManagement.ServiceManager.Incident.Workflows</AssemblyName>
<WorkflowTypeName>Microsoft.EnterpriseManagement.ServiceManager.Incident.Workflows.AutomaticIncidentChangeWorkflow</WorkflowTypeName>
<WorkflowParameters>
<WorkflowArrayParameter Name=”InstanceIds” Type=”guid”>
<Item>$Data/BaseManagedEntityId$</Item>
</WorkflowArrayParameter>
<WorkflowParameter Name=”IncidentTemplate” Type=”guid”>A035C6E5-2ADA-334A-3D01-24F4398A5BB1</WorkflowParameter>
<WorkflowParameter Name=”NotificationRulesEnabled” Type=”boolean”>False</WorkflowParameter>
</WorkflowParameters>
<RetryExceptions />
<RetryDelaySeconds>60</RetryDelaySeconds>
<MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>
</WindowsWorkflowConfiguration>
</Subscription>
</WriteAction>
</WriteActions>
</Rule>
</Rules>
</Monitoring>
<LanguagePacks>
<LanguagePack ID=”ENU” IsDefault=”true”>
<DisplayStrings>
<DisplayString ElementID=”ActionLogAddRelationshipSubscription”>
<Name>Action Log Add Relationship Subscription</Name>
</DisplayString>
<DisplayString ElementID=”ActionLogAddRelationshipSubscriptionRule”>
<Name>Action log entry added to action log</Name>
</DisplayString>
</DisplayStrings>
</LanguagePack>
</LanguagePacks>
</ManagementPack>

 

Here is a summarize of the steps that is needed for this: (since I use Anders solution for templates and workflows, there is a more detailed description how to do that in his blog http://www.scsm.se/?p=564.

  1. Create an Incident Template with settings that you want to apply for an updated incident. This is the template that we adds in the management pack with a GUID. My template just changes the UpdatedByEndUser to true. I think this is a great solution to use, but you can also have a template that for example just change the status to updated.(read Anders blog to see the advantages with his solution)
  2. Create a workflow that triggers on when your template is added that will send an e-mail to the Affected User. (see more information in Anders blog)
  3. Copy my mp and change the GUID to match your incident template.
  4. Import the mp

In step 3 in Anders article where he adds a template for the Exchange Connector I use a template that doesn´t do any change at all. We don´t need to set the UpdatedByEndUser to true since that will be done by our mp when an End-User comment is aded to the action log )

Step 5 in Anders description where you creates two workflows is little special in 2012 or at least in my environment. I don´t know if it´s a bug or if it´s unique in my environment.
I can´t create the criteria changed from NOT EQUAL true for the UpdatedByEndUser.
I have to set criteria EQUAL and then change it to NOT EQUAL in XML after I have exported the mp.
If I then import the mp again it work as expected but when you look at the workflow in the console it still says EQUAL. If I export the management pack again I can see that it says NOT EQUAL in XML as it also should do in the console.

This solution doesn´t send a notify if the Affected User resolves the incident on the SSP by clicking “cancel request”. Because when they do that it doesn´t creates an End-User comment in the Action log, it will create a “Record Resolved” entry instead. If I find a good solution for how to cover that I will create a new blog post.

 

 

To do the same for a service request you need to use a different relationship type. I haven´t created that mp yet but will create a blog for that also when I´m done with that.

New gallery upload: Remind Reviewers

March 6, 2012 Posted by Anders Asp

While working on a project for a customer of mine which involves a lot of approval steps, I realized that the whole process would be halted if someone forgets to cast their vote on a review activity. In order to prevent this from happening I created a powershell script to remind the reviewers who hasn’t voted for a certain period of time that we are awaiting their approval.

There’s a couple of parameters to configure in the script, but otherwise it’s ready to use. This is how the reminder e-mail might look:

Read more and download the script at the TechNet gallery:
http://gallery.technet.microsoft.com/Mail-notification-Remind-1167b6c5