locked
Adding custom email template to assigned to notification MP RRS feed

  • Question

  • Hi, I've completed the steps in the blog article on how to create a notification when the assigned to field is changed:

    http://blogs.technet.com/b/servicemanager/archive/2009/12/15/custom-notification-workflow-on-incident-assignement-or-re-assignment.aspx

    Everything is good and the emails are being sent to the new agents when the "assigned to" field is changed.  Now I'd like to add a second notification so that the "affected user" is also sent an email when the status is changed AND I'd like to use a custom email template to send the email.

    1. How do I edit the MP to add a second notification to the affected user (i.e. what extra code do I need to add?)

    2. How do I get the GUID for my custom template?  I've been unable to follow the directions to find the GUID of my custom template and was hoping for a more step-by-step instruction

     

    Thanks for your help!

     

    Wednesday, December 15, 2010 9:33 PM

All replies

  • I just did this one today, so hopefully I can help :). 

    The article you link (I followed the same one) has this section listed:

    vi.   You can replace the Template GUID with your own template GUID, if you have one created.
    
             <WorkflowArrayParameter Name="NotificationTemplates" Type="guid">
    
              <Item>50dc32c2-6517-e9ea-dd99-0455383cab17</Item>
    
             </WorkflowArrayParameter>
    
               #
                In order to get the GUID for your own template from the DB you can use a simple query
               #
                Here is the one I used to get the GUID for the template that I used
    
              "select Objecttemplateid from ObjectTemplate where ObjectTemplateName='AssignedToUserNotificationTemplate'

     

    So basically you need to go into the SQL table for your ServiceManager database, find the table called 'dbo.ObjectTemplate', and do a select query there.  I did one like 'Select * from ObjectTemplate"

    When I went and looked in that table, I couldn't find my template listed by name -- in fact, it had a weird/wacky name when I had it.  I sorted the table by Created Date (using Order By in the sql query), and was able to figure out which template I was looking for (because I had Created the template that day.  You could do the same with 'Modified Date' if you want).  I took the GUID listed and put it in the code as described in your article.

    It worked like a charm :). 

                                                             


    -Direwolf
    Friday, February 18, 2011 8:35 PM
  • When I went and looked in that table, I couldn't find my template listed by name -- in fact, it had a weird/wacky name when I had it.  I sorted the table by Created Date (using Order By in the sql query), and was able to figure out which template I was looking for (because I had Created the template that day.  You could do the same with 'Modified Date' if you want).  I took the GUID listed and put it in the code as described in your article.

    It worked like a charm :). 

                                                             


    -Direwolf


    When templates and views are created in the console they're given a seemingly random name..it always has a Guid in it (I'd wager the GUID is actually a hash and not necessarily random..but I digress :) ). You can positively identify the template you're looking for by looking in your MP first. The "short-cut" is to search for the actual name you gave it (eg: My Change Request Notification Template). This will lead you to a DisplayString in the management pack. The ElementID of that display string will be the actual ID of the template you created. Then you can query the ObjectTemplate table for that specific ID.

    Don't forget you don't have to export your MP to examine it..you can look at it by querying the ManagementPacks table..eg:

    SELECT TOP 1000 [ManagementPackId]
      ,[MPIsSealed]
      ,[MPName]
      ,[MPFriendlyName]
      ,[MPVersion]
      ,[MPKeyToken]
      ,convert(xml,[MPXML])
     FROM [ServiceManager].[dbo].[ManagementPack]
    where MPName = 'My.Management.Pack'
    

    convert(xml,[MPXML]) is the important part..just click on the blue text in the results and it'll show you your whole MP.

    http://blogs.technet.com/b/servicemanager/archive/2009/12/31/service-manager-database-tour-useful-queries.aspx?wa=wsignin1.0
    That post shows some other handy queries..they make wading through the bowels of Service Manager less overwhelming :)

    Friday, February 18, 2011 10:27 PM