Notify Assigned to when the Affected User updates a Service Request from the SSP in SCSM 2012

August 20, 2012 Posted by Stefan Allansson

UPDATE: 05 October 2012 – Please Read

I have done a little change in my code. The original code did send an notification not only if the end user updated the action log, but also if an analyst wrote somethin in the action log from the console.
Thats not what I wanted so I have changed this part:
Old:
TargetType=”$MPElement[Name=’WorkItem!System.WorkItem.CommentLog’]$”
New:
TargetType=”$MPElement[Name=’WorkItem!System.WorkItem.TroubleTicket.UserCommentLog’]$”

—————————————————————————————————————————–

I guess we can say this is a “part 2” blog post about notifications when the end user updates a work item.
The first one that you finds here is for incidents and this is for Service Requests.

For the incident I added an incident template so we could change the status of the incident to “Updated” at same time as we sends the notification to the assigned to user.
For a Service Request I don´t want to change the status, since the status is controlled by the Activities in the Service Request. When the last activity is completed, the service request will also be completed.

I just want to send an e-mail to the assigned to user when the service request is updated by the end user.
For this I have created a similar management pack as in the blog post for incidents that I mentioned above.
I have changed it a little bit so it fits for a service request instead of an incident.
This time I add a notification template instead of a “work item template”, since I just want to send an e-mail.
I also point out the assigned to user as the recipient.

Below you can see the management pack that I have used.
You need to change the GUID (8F842F05-FDE0-31F0-1083-54E111099AA3) 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’

This query will probably work if you use a built in template but not if you want to use one that you created in the console.
This is because of that the ObjectTemplateName isn´t the same as the display name that your template have in the console. Use this query below instead and compare the result for date and time for when it was created and last changed with the time that you can see in the console for your template.(the time in SQL is showing GMT so the hours can differs from what you see in your console, but the minutes and seconds will be correct.

select * from ObjectTemplate

 

<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>LumagateServiceRequestActionLogAddRelationshipSubscription</ID>
      <Version>1.0.0.0</Version>
    </Identity>
    <Name>Lumagate Service Request Action Log Add Relationship Subscription</Name>
    <References>
      <Reference Alias=”Console”>
        <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
        <Version>7.5.1561.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias=”NotificationsLibrary”>
        <ID>System.Notifications.Library</ID>
        <Version>7.5.1561.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias=”WorkItem”>
        <ID>System.WorkItem.Library</ID>
        <Version>7.5.1561.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias=”System”>
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias=”Subscriptions”>
        <ID>Microsoft.SystemCenter.Subscriptions</ID>
        <Version>7.5.1561.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias=”Administration”>
        <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>
        <Version>7.5.1561.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias=”ServiceRequest”>
        <ID>ServiceManager.ServiceRequest.Library</ID>
        <Version>7.5.1561.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    </References>
  </Manifest>
  <Categories>
    <Category ID=”Category.ActionLogAddRelationshipSubscriptions.ManagementPack” Value=”Console!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack”>
      <ManagementPackName>LumagateServiceRequestActionLogAddRelationshipSubscription</ManagementPackName>
      <ManagementPackVersion>7.0.5826.0</ManagementPackVersion>
    </Category>
    <Category ID=”Category.ServiceRequestActionLogAddRelationshipSubscriptionRule” Target=”ServiceRequestActionLogAddRelationshipSubscriptionRule” Value=”Administration!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions” />
  </Categories>
  <Monitoring>
    <Rules>
      <Rule ID=”ServiceRequestActionLogAddRelationshipSubscriptionRule” Enabled=”true” Target=”ServiceRequest!System.WorkItem.ServiceRequest.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.WorkItemHasCommentLog’]$” SourceType=”$MPElement[Name=’WorkItem!System.WorkItem’]$” 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>false</EnableBatchProcessing>
   <WindowsWorkflowConfiguration>
    <AssemblyName>Microsoft.EnterpriseManagement.WorkflowFoundation</AssemblyName>
    <WorkflowTypeName>Microsoft.EnterpriseManagement.WorkflowFoundation.ConfigurationWorkflow</WorkflowTypeName>
   <WorkflowParameters>
    <WorkflowParameter Name=”InstanceId” Type=”guid”>$Data/BaseManagedEntityId$</WorkflowParameter>
    <WorkflowArrayParameter Name=”NotificationTemplateIdList” Type=”guid”><Item>8F842F05-FDE0-31F0-1083-54E111099AA3</Item></WorkflowArrayParameter>
    <WorkflowArrayParameter Name=”UserAliasOrRelationships” Type=”string”><Item>$MPElement[Name=’WorkItem!System.WorkItemAssignedToUser’]$</Item></WorkflowArrayParameter>
   </WorkflowParameters>
   <RetryExceptions />
   <RetryDelaySeconds>60</RetryDelaySeconds>
   <MaximumRunningTimeSeconds>1500</MaximumRunningTimeSeconds>
  </WindowsWorkflowConfiguration>
   </Subscription>
   </WriteAction>
  </WriteActions>
  </Rule>
  </Rules>
  </Monitoring>
  <LanguagePacks>
    <LanguagePack ID=”ENU” IsDefault=”true”>
      <DisplayStrings>
        <DisplayString ElementID=”LumagateServiceRequestActionLogAddRelationshipSubscription”>
          <Name>Lumagate Service Request Action Log Add Relationship Subscription</Name>
        </DisplayString>
        <DisplayString ElementID=”ServiceRequestActionLogAddRelationshipSubscriptionRule”>
          <Name>Service Request Action log entry added to action log</Name>
        </DisplayString>
      </DisplayStrings>
    </LanguagePack>
  </LanguagePacks>
</ManagementPack>

 
If you for some reson want to add a Service Request template instead of a notification template you have to change the mp a little bit. The part for <WorkflowParameters> is not the same as the mp above.
Here is a mp that works but you need to change the GUID (F473AAAF-8B64-2100-723D-40F7CF62C069) to the GUID for your own template.

<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>LumagateServiceRequestActionLogAddRelationshipSubscription</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=”System”>
        <ID>System.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>
      <Reference Alias=”ServiceRequest”>
        <ID>ServiceManager.ServiceRequest.Library</ID>
        <Version>7.5.1561.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    </References>
  </Manifest>
  <Categories>
    <Category ID=”Category.ActionLogAddRelationshipSubscriptions.ManagementPack” Value=”Console!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack”>
      <ManagementPackName>LumagateServiceRequestActionLogAddRelationshipSubscription</ManagementPackName>
      <ManagementPackVersion>7.0.5826.0</ManagementPackVersion>
    </Category>
    <Category ID=”Category.ServiceRequestActionLogAddRelationshipSubscriptionRule” Target=”ServiceRequestActionLogAddRelationshipSubscriptionRule” Value=”Administration!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions” />
  </Categories>
  <Monitoring>
    <Rules>
      <Rule ID=”ServiceRequestActionLogAddRelationshipSubscriptionRule” Enabled=”true” Target=”ServiceRequest!System.WorkItem.ServiceRequest.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.WorkItemHasCommentLog’]$” SourceType=”$MPElement[Name=’WorkItem!System.WorkItem’]$” 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>false</EnableBatchProcessing>
              <WindowsWorkflowConfiguration>
                <AssemblyName>Microsoft.EnterpriseManagement.WorkflowFoundation</AssemblyName>
                <WorkflowTypeName>Microsoft.EnterpriseManagement.WorkflowFoundation.ConfigurationWorkflow</WorkflowTypeName>
                <WorkflowParameters>
                  <WorkflowParameter Name=”InstanceId” Type=”guid”>$Data/BaseManagedEntityId$</WorkflowParameter>
                  <WorkflowParameter Name=”InstanceTemplate” Type=”guid”>F473AAAF-8B64-2100-723D-40F7CF62C069</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=”LumagateServiceRequestActionLogAddRelationshipSubscription”>
          <Name>Lumagate Service Request Action Log Add Relationship Subscription</Name>
        </DisplayString>
        <DisplayString ElementID=”ServiceRequestActionLogAddRelationshipSubscriptionRule”>
          <Name>Service Request Action log entry added to action log</Name>
        </DisplayString>
      </DisplayStrings>
    </LanguagePack>
  </LanguagePacks>
</ManagementPack>

 

10 Responses to Notify Assigned to when the Affected User updates a Service Request from the SSP in SCSM 2012

  1. Boris Petrov says:

    This solution works perfectly, but I am experiencing some difficulties defining the notification template. How can I create a notification template which sends only the last comment. I am trying to use the “ Work Item Comments Log” class as a target class in the template and using the “ Work Item Has Comment Log” related class (EnteredDate, EnteredBy, Comment properties). The thing is that email is empty at the end. Probably I am not doing something right. Can you advise me how to create a notification template which send only the last comment added. Thank you.

    • Anders Asp says:

      Hi Boris,

      As of now this is not possible to do within Service Manager – you would have to create your own custom workflow to achieve this.

      Regards
      //Anders

  2. GillesP says:

    Thanks for this very interresting blog.
    But i would like to Notify Affected User when Assigned to updates a Service Request from Console.
    Is it possible ? if yes, how ?
    Thanks.

  3. Anders Asp says:

    GillesP

    So whenever a technician updates the SR from the console you want the Affected User to get a notification?

    Regards
    //Anders

  4. Chris Stelzer says:

    What target class should I be using for the notification template? I’ve tried the “Trouble Ticket User Comments”, as i’ve done for Incidents, but when the template is e-mailed out, all my variables are blank (ie. Title, ID, etc).

    Do you have an example of your notification template?

  5. chwilówki says:

    Hi there, I enjoy reading all of your article.I like to write a little comment to support you.

  6. I do not know if it’s just me or if everyone else encountering
    problems with your blog. It appears as if some of the text within your posts are running off the screen. Can someone else please provide feedback and let me
    know if this is happening to them too? This might be a problem with my web
    browser because I’ve had this happen previously. Kudos

  7. mabosbet says:

    For anybody who like to perform gambling and if you usually are looking for
    partners within gambling activities, Mabosbet is the right choice.
    Mabosbetransfer You can contact the customer service and
    make purchases with us. Mabosbet livechat is available 24 hours nonstop and is ready to serve you and help you online with wagering.

    Mabosbet. com as the responsible gambling agent, we always provide an alternate link
    to mabosbet to ensure that members feel comfortable.

    You no longer require to have trouble getting an alternative Jababbet link
    for access, it is previously available for you.

    All of us also always give concern to the safety of our members,
    very stringent protecting all the privacy of
    members of Jababbet.

    Reliable Mabosbet From 2010

    With good praise, the services from the Headquarters will be no doubt.

    Friendly, quickly response, under 3 mins.

    Mabosbet is highly appreciated by gambling bettors coming from Indonesia because whatever triumph you get will
    probably be recognized by mabosvip. We usually want to provide typically the
    great for members with highest service. The site mabosmail.
    com is additionally very an easy task to access, as you
    only need internet access and alternate links mabosvip, no want to use proxies, newsletters, or troublesome applications.

    Of which is why many folks join mabosbola and create
    deposits, then, win typically the match. The best and quality alternative mabosbola alternate site.

    Come join mabosbet. com the trusted on the
    internet gambling agent in Indonesia. Contact livechat mabosbet
    today in the lower proper corner to get a user ID.
    Welcome in order to the club.

    MABOSBET will be a Trusted Online Gambling Site that has recently been established
    for more than 9 years with the greatest number of online betting players.
    This gambling web site also provides the most satisfactory online gambling game along with the most popular betting providers in Indonesia.
    On-line Gambling Games that can be played at MABOSBET are Sportsbook Soccer
    Wagering, Live Casino, Online Poker Card Gambling, Online Slot Wagering and
    Online Togel. Mabosbet itself has provided a variety of
    excellent facilities for gambling online players in Indonesia starting
    from 24-hour Live Chat Help, Bonuses with the simplest conditions,
    additional wins for True Gambling Players.

    This specific MABOSBET Gambling Site also proves
    to get very reliable, while this Gambling Internet site can also pay with
    regard to any winning player without deductions. So you may play gambling comfortably plus safely without anxiety about having to pay.
    In addition to a definite win at MABOSBET, you
    will also provide additional bonuses to supply a different experience playing online gambling.

    JOBI BALL OFFICIAL SBOBET ONLINE INSIDE INDONESIA
    Online Soccer Wagering has become a extremely popular gambling online game within Indonesia where every online game
    has a market with regard to betting. MABOSBET has become a great official partner of SGD777 Indonesia,
    where more as compared to 7 years has provided sports gambling games
    for wagering players in Indonesia. This specific SBOBET Soccer Gambling Industry allows a fair where gamers will actually
    be provided with a new live market from your recognized match directly.
    Which means you will be very lucky to be able to play SBOBET in this
    specific MABOSBET.

    RELIABLE ONLINE SLOT SITE SITE NUMEROUS INCOME
    Online slot gambling is currently popular in Indonesia, where
    online slots are extremely successful with huge jackpots and freespins
    that are straightforward to win. Because of that this MABOSBET first provided Online Slot Games from 2012 for betting players in Indonesia.
    Exactly where Jackpot is provided a lot more than USD $ one, 000,
    000 for slot players who register at MABOSBET. The Slot Game
    machine at MABOSBET won’t just use your Equilibrium, the
    Slot Game provides been built with the FREESPIN Bonus
    that comes away more often, so an individual is going to be Fortunately.

  8. To be able to choose an online gambling site that
    can be trustworthy and provide the best service, you
    must know and know first with the betting website
    that you will choose. Also make sure the web betting that you find
    meets the requirements as the best online gambling site.

    Do Research in Forums

    The least difficult way to make sure you can safely use a wagering site or not is to read or participate in discussion posts with people in online gambling forums.
    All those in the betting forum are usually experienced players
    and know which betting sites offers the best service.

    Inquire the Player

    If speaking about in a discussion board is difficult that you can do or do not know which forum you can visit to do research, we suggest
    that you directly ask the more experienced players. In addition you can also ask
    for tips and tricks on the best strategies that may be applied in the game

Leave a Reply

Your email address will not be published. Required fields are marked *

*