Custom notification workflow on incident assignement or re-assignment

Custom notification workflow on incident assignement or re-assignment

  • Comments 89

There are couple important contributions from our users I wanted highlight

  1. There were quite a few requests to Notify additional recipients (e.g. Affected User / Primary Owner) on the assignment changes.  Andrew France has written the MP that does this.  Here is the MP
  2. Another useful blog post that has been created by one of SCSM admirers on this topic that users have found helpful.

As always ensure that the MP is what you need before importing it.

 

Thanks for your contributions.  Keep them coming! It keeps the community vibrant and alive!

------------ original post ------

This blog posts demonstrates how to configure a notification workflow in Service Manager that sends out notifications on reassignment of the incident.

I am not going to go through details on management pack mechanics as they are already available here.

 

Steps for creating this custom workflow:

1.       Create a new XML file – Name it: ServiceManager.IncidentAssignmentChanges.Notification

2.       Copy and paste the  complete XML provided at the end of the post

3.       Change the version number in the file with version to match your build

a.       i.e. if you are using Beta 2 then build number is 5229, If you are using Beta 2 update, then you do not need to change the build number it is already 5244

b.      The version string that you need to change for all references is shown below:

                                                               i.      <Version>7.0.5244.0</Version>

c.       You can look up the build on Service Manager Help-> About

4.       Save the File as ServiceManager.IncidentAssignmentChanges.Notification.xml

5.       Last Step is to Import the management pack

a.       Open Service Manager Console

b.      Go to Administration -> Management Packs

c.       Click on “Import” in the task pane

d.      ClickAdd” in the MP Import screen

e.      Select the management pack file that you created

f.        Click Import

g.       If you get errors, please check again your MP against the XML I have provided.

                                                               i.      Also check the version information – Did you change the build number to match your build.

6.       Verification

a.       Open Service Manager Console

b.      Go to Administration->Workflows->Status

c.       You should see “Incident Assignment Notification” in the view pane as shown below

 

Here is some explanation of some of the sections of the Management pack to better understand the “how”

1.       Manifest Section

a.       The references section lists the dependencies for this management pack

b.      Aliases defined for these references just makes it easier to refer to these management packs in the subsequent sections

2.       Categories section

a.       This enables the Workflow to appear in the Service Manager Console UI (Administration->Workflow->Status node)

b.      This allows you to either enable or disable the workflow from the Console UI, thus avoiding having to go and edit (or delete) the management pack, each time you want to disable the workflow

3.       Monitoring Section

a.       In the Monitoring section we define the Rules.  Each rule is generally comprised of a DataSource and WriteAction

b.      DataSource define discovery of the instances based on certain criteria

                                                               i.      In this case we want to discover any incident for which the “Assigned to” user is changed

                                                             ii.      “Assigned To” user is a relationship on the Incident – So whenever the assignment is changed the existing relationship is deleted and a new relationship is added

                                                            iii.      The criteria below discovers all instances of incidents for which a “AssignedTo” Relationship was added

c.       WriteAction defines the “action” you want to perform on each instance that was discovered by the rule

                                                               i.      Write Action is generally associated with an Activity/Task (generally a WinWF activity).

                                                             ii.      In this case we are re-using an activity that comes with Incident Event Workflow

                                                            iii.      Note:  This is not a published activity in our Authoring library, so the parameters potentially could change in future

<AssemblyName>Microsoft.EnterpriseManagement.ServiceManager.Incident.Workflows</AssemblyName>           <WorkflowTypeName>Microsoft.EnterpriseManagement.ServiceManager.Incident.Workflows.AutomaticIncidentChangeWorkflow</WorkflowTypeName>

 

                                                           iv.       The activity takes the “Relationship GUID” for the “Assigned To” relationship and a “notification template GUID” as parameters.

                                                             v.      Do not change the “Relationship GUID”

                  <WorkflowArrayParameter Name="UserAliasOrRelationships" Type="string">

                    <Item>15e577a3-6bf9-6713-4eac-ba5a5b7c4722</Item>

 

                                                           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'

4.       Language Pack section:

a.       This enables display of user friendly names in the UI.

b.      You should also review the blog for details regarding localizing the UI.

 

 

5.       Complete XML that you can just cut and paste in your file

·         Please note that this is for build 5244, (that is the latest Public Beta 2 bits that were refreshed)

·         You should change the build number to the appropriate build number (5229 for Beta 2, 5244 for Beta 2 update)

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

  <Manifest>

    <Identity>

      <ID>ServiceManager.IncidentAssignmentChanges.Notification</ID>

      <Version>7.0.5244.0</Version>

    </Identity>

    <Name>Incident Assignment Changes Notification Workflow</Name>

    <References>

      <Reference Alias="WorkItem">

        <ID>System.WorkItem.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="Incident">

        <ID>ServiceManager.IncidentManagement.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="CoreIncident">

        <ID>System.WorkItem.Incident.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="SystemCenter">

        <ID>Microsoft.SystemCenter.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="SystemCenter1">

        <ID>Microsoft.SystemCenter.Subscriptions</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="Administration">

        <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="System">

        <ID>System.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

    </References>

  </Manifest>

    <Categories>

    <Category ID="IncidentConfigurationMPSolutionCategory" Value="Incident!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack.Solution.IncidentManagement">

      <ManagementPackName>ServiceManager.IncidentAssignmentChanges.Notification</ManagementPackName>

      <ManagementPackVersion>7.0.5244.0</ManagementPackVersion>

    </Category>

      <Category ID="Category.IncidentAssignmentChanges" Target="IncidentAssignmentChanges" Value="Administration!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />

  </Categories>

 

  <Monitoring>

    <Rules>

      <Rule ID="IncidentAssignmentChanges" Enabled="true" Target="SystemCenter!Microsoft.SystemCenter.SubscriptionWorkflowTarget" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100">

        <Category>Discovery</Category>

        <DataSources>

          <DataSource ID="DS" TypeID="SystemCenter1!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">

            <Subscription>

              <RelationshipSubscription RelType="$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$" SourceType="$MPElement[Name='CoreIncident!System.WorkItem.Incident']$" TargetType="$MPElement[Name='System!System.Domain.User']$">

                <AddRelationship>

                </AddRelationship>

              </RelationshipSubscription>

              <PollingIntervalInSeconds>10</PollingIntervalInSeconds>

              <BatchSize>100</BatchSize>

            </Subscription>

          </DataSource>

        </DataSources>

        <WriteActions>

          <WriteAction ID="WA" TypeID="SystemCenter1!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="NotificationRulesEnabled" Type="boolean">True</WorkflowParameter>

                  <WorkflowArrayParameter Name="NotificationTemplates" Type="guid">

                    <Item>50dc32c2-6517-e9ea-dd99-0455383cab17</Item>

                  </WorkflowArrayParameter>

                  <WorkflowArrayParameter Name="UserAliasOrRelationships" Type="string">

                    <Item>15e577a3-6bf9-6713-4eac-ba5a5b7c4722</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="ServiceManager.IncidentAssignmentChanges.Notification">

          <Name>Service Manager Incident Assignment Changes Notification Workflow</Name>

          <Description>Service Manager Incident Assignement Changes Workflow</Description>

        </DisplayString>

        <DisplayString ElementID="IncidentAssignmentChanges">

          <Name>Incident Assignement Notification</Name>

        </DisplayString>

      </DisplayStrings>

    </LanguagePack>

    </LanguagePacks>

</ManagementPack>

Leave a Comment
  • Please add 7 and 7 and type the answer here:
  • Post
  • I just noticed that my version in the XML is 7.0.655.115 which I believe is CU2.

    Ours is 7.0.655.128 which is CU3. I'm going to modify these version numbers and see if this fixes the issue... I'll post back. Thanks !

  • Same error that I posted.. It faults at

    Event: 12

    Activity Name: sendNotificationsActivity1

    Activity Type: Microsoft.EnterpriseManagement.Notifications.Workflows.SendNotificationsActivity

  • @Mike @Ketan - I wish my life was as exciting enough to have a blog, maybe SC 2012 will change all that :-). I should thank scsmsource.blogspot.co.uk/.../work-item-assignmentreassignment.html for my starting point. @Mike it will be dead simple to switch primaryowner to assigned user, as that's how it started life. Also, never mucked about with this type of stuff before, so check it over, but it works for me so far...

    <ManagementPack ContentReadable="true" SchemaVersion="2.0" OriginalSchemaVersion="1.1" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsl="www.w3.org/.../Transform">

     <Manifest>

       <Identity>

         <ID>Custom.WorkItem.Assignment.Workflow.Library</ID>

         <Version>7.5.1561.0</Version>

       </Identity>

       <Name>Custom WorkItem Assignment Workflow Library</Name>

       <References>

         <Reference Alias="EnterpriseManagement">

           <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="ChangeManagement">

           <ID>ServiceManager.ChangeManagement.Library</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="CoreProblem">

           <ID>System.WorkItem.Problem.Library</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="CustomSystem_Notifications_Library">

           <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="IncidentManagement">

           <ID>ServiceManager.IncidentManagement.Library</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="CoreChangeRequest">

           <ID>System.WorkItem.ChangeRequest.Library</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="CoreActivity">

           <ID>System.WorkItem.Activity.Library</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="ActivityManagement">

           <ID>ServiceManager.ActivityManagement.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="CoreIncident">

           <ID>System.WorkItem.Incident.Library</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="SystemCenter">

           <ID>Microsoft.SystemCenter.Subscriptions</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

         <Reference Alias="EnterpriseManagement1">

           <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>

           <Version>7.5.1561.0</Version>

           <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

         </Reference>

       </References>

     </Manifest>

     <Categories>

       <Category ID="Category.Custom.WorkItem.Assignment.Workflow.Library.ManagementPack" Value="EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack">

         <ManagementPackName>Custom.WorkItem.Assignment.Workflow.Library</ManagementPackName>

         <ManagementPackVersion>7.5.1561.0</ManagementPackVersion>

       </Category>

       <Category ID="Category.IncidentAssignedToUserAddRule" Target="IncidentAssignedToUserAddRule" Value="EnterpriseManagement1!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />

       <Category ID="Category.ActivityAssignedToUserAddRule" Target="ActivityAssignedToUserAddRule" Value="EnterpriseManagement1!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />

       <Category ID="Category.ChangeRequestAssignedToUserAddRule" Target="ChangeRequestAssignedToUserAddRule" Value="EnterpriseManagement1!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />

       <Category ID="Category.ProblemAssignedToUserAddRule" Target="ProblemAssignedToUserAddRule" Value="EnterpriseManagement1!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />

       <Category ID="ServiceManager.Console.NotificationManagement.NotificationTemplates.IncidentAssignedToUserNotificationAffectedUserTemplate.Category" Target="IncidentAssignedToUserNotificationAffectedUserTemplate" Value="EnterpriseManagement1!ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration" />

       <Category ID="ServiceManager.Console.NotificationManagement.NotificationTemplates.IncidentAssignedToUserNotificationPrimaryOwnerTemplate.Category" Target="IncidentAssignedToUserNotificationPrimaryOwnerTemplate" Value="EnterpriseManagement1!ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration" />

       <Category ID="ServiceManager.Console.NotificationManagement.NotificationTemplates.ActivityAssignedToUserNotificationTemplate.Category" Target="ActivityAssignedToUserNotificationTemplate" Value="EnterpriseManagement1!ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration" />

       <Category ID="ServiceManager.Console.NotificationManagement.NotificationTemplates.ChangeRequestAssignedToUserNotificationTemplate.Category" Target="ChangeRequestAssignedToUserNotificationTemplate" Value="EnterpriseManagement1!ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration" />

       <Category ID="ServiceManager.Console.NotificationManagement.NotificationTemplates.ProblemAssignedToUserNotificationTemplate.Category" Target="ProblemAssignedToUserNotificationTemplate" Value="EnterpriseManagement1!ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration" />

     </Categories>

     <Monitoring>

       <Rules>

         <Rule ID="IncidentAssignedToUserAddRule" Enabled="true" Target="IncidentManagement!System.WorkItem.Incident.WorkflowTarget" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">

           <Category>System</Category>

           <DataSources>

             <DataSource ID="DS" TypeID="SystemCenter!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">

               <Subscription>

                 <RelationshipSubscription RelType="$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$" SourceType="$MPElement[Name='CoreIncident!System.WorkItem.Incident']$" TargetType="$MPElement[Name='System!System.Domain.User']$">

                   <AddRelationship />

                 </RelationshipSubscription>

                 <PollingIntervalInSeconds>30</PollingIntervalInSeconds>

                 <BatchSize>100</BatchSize>

               </Subscription>

             </DataSource>

           </DataSources>

           <WriteActions>

             <WriteAction ID="WA" TypeID="SystemCenter!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="UserRelationshipIdList" Type="guid">

                       <Item>$MPElement[Name='WorkItem!System.WorkItemAffectedUser']$</Item>

                       <Item>$MPElement[Name='CoreIncident!System.WorkItem.IncidentPrimaryOwner']$</Item>

                     </WorkflowArrayParameter>

                     <WorkflowArrayParameter Name="NotificationTemplateIdList" Type="guid">

                       <Item>$MPElement[Name='IncidentAssignedToUserNotificationAffectedUserTemplate']$</Item>

                       <Item>$MPElement[Name='IncidentAssignedToUserNotificationPrimaryOwnerTemplate']$</Item>

                     </WorkflowArrayParameter>

                   </WorkflowParameters>

                   <RetryExceptions />

                   <RetryDelaySeconds>60</RetryDelaySeconds>

                   <MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>

                 </WindowsWorkflowConfiguration>

               </Subscription>

             </WriteAction>

           </WriteActions>

         </Rule>

         <Rule ID="ActivityAssignedToUserAddRule" Enabled="true" Target="ActivityManagement!System.WorkItem.Activity.WorkflowTarget" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">

           <Category>System</Category>

           <DataSources>

             <DataSource ID="DS" TypeID="SystemCenter!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">

               <Subscription>

                 <RelationshipSubscription RelType="$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$" SourceType="$MPElement[Name='CoreActivity!System.WorkItem.Activity']$" TargetType="$MPElement[Name='System!System.Domain.User']$">

                   <AddRelationship />

                 </RelationshipSubscription>

                 <PollingIntervalInSeconds>30</PollingIntervalInSeconds>

                 <BatchSize>100</BatchSize>

               </Subscription>

             </DataSource>

           </DataSources>

           <WriteActions>

             <WriteAction ID="WA" TypeID="SystemCenter!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="UserRelationshipIdList" Type="guid">

                       <Item>$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$</Item>

                     </WorkflowArrayParameter>

                     <WorkflowArrayParameter Name="NotificationTemplateIdList" Type="guid">

                       <Item>$MPElement[Name='ActivityAssignedToUserNotificationTemplate']$</Item>

                     </WorkflowArrayParameter>

                   </WorkflowParameters>

                   <RetryExceptions />

                   <RetryDelaySeconds>60</RetryDelaySeconds>

                   <MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>

                 </WindowsWorkflowConfiguration>

               </Subscription>

             </WriteAction>

           </WriteActions>

         </Rule>

         <Rule ID="ChangeRequestAssignedToUserAddRule" Enabled="true" Target="ChangeManagement!System.WorkItem.ChangeRequest.WorkflowTarget" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">

           <Category>System</Category>

           <DataSources>

             <DataSource ID="DS" TypeID="SystemCenter!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">

               <Subscription>

                 <RelationshipSubscription RelType="$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$" SourceType="$MPElement[Name='CoreChangeRequest!System.WorkItem.ChangeRequest']$" TargetType="$MPElement[Name='System!System.Domain.User']$">

                   <AddRelationship />

                 </RelationshipSubscription>

                 <PollingIntervalInSeconds>30</PollingIntervalInSeconds>

                 <BatchSize>100</BatchSize>

               </Subscription>

             </DataSource>

           </DataSources>

           <WriteActions>

             <WriteAction ID="WA" TypeID="SystemCenter!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="UserRelationshipIdList" Type="guid">

                       <Item>$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$</Item>

                     </WorkflowArrayParameter>

                     <WorkflowArrayParameter Name="NotificationTemplateIdList" Type="guid">

                       <Item>$MPElement[Name='ChangeRequestAssignedToUserNotificationTemplate']$</Item>

                     </WorkflowArrayParameter>

                   </WorkflowParameters>

                   <RetryExceptions />

                   <RetryDelaySeconds>60</RetryDelaySeconds>

                   <MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>

                 </WindowsWorkflowConfiguration>

               </Subscription>

             </WriteAction>

           </WriteActions>

         </Rule>

         <Rule ID="ProblemAssignedToUserAddRule" Enabled="true" Target="CoreProblem!System.WorkItem.Problem.WorkflowTarget" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">

           <Category>System</Category>

           <DataSources>

             <DataSource ID="DS" TypeID="SystemCenter!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">

               <Subscription>

                 <RelationshipSubscription RelType="$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$" SourceType="$MPElement[Name='CoreProblem!System.WorkItem.Problem']$" TargetType="$MPElement[Name='System!System.Domain.User']$">

                   <AddRelationship />

                 </RelationshipSubscription>

                 <PollingIntervalInSeconds>30</PollingIntervalInSeconds>

                 <BatchSize>100</BatchSize>

               </Subscription>

             </DataSource>

           </DataSources>

           <WriteActions>

             <WriteAction ID="WA" TypeID="SystemCenter!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="UserRelationshipIdList" Type="guid">

                       <Item>$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$</Item>

                     </WorkflowArrayParameter>

                     <WorkflowArrayParameter Name="NotificationTemplateIdList" Type="guid">

                       <Item>$MPElement[Name='ProblemAssignedToUserNotificationTemplate']$</Item>

                     </WorkflowArrayParameter>

                   </WorkflowParameters>

                   <RetryExceptions />

                   <RetryDelaySeconds>60</RetryDelaySeconds>

                   <MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>

                 </WindowsWorkflowConfiguration>

               </Subscription>

             </WriteAction>

           </WriteActions>

         </Rule>

       </Rules>

     </Monitoring>

     <Templates>

       <ObjectTemplate ID="IncidentAssignedToUserNotificationAffectedUserTemplate" TypeID="CustomSystem_Notifications_Library!System.Notification.Template.SMTP">

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Subject$"><1033>[$Context/Property[Type='WorkItem!System.WorkItem']/Id$] - $Context/Property[Type='WorkItem!System.WorkItem']/Title$</1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Priority$">2</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/IsBodyHtml$">False</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Content$"><1033>Dear $Context/Path[Relationship='WorkItem!System.WorkItemAffectedUser' TypeConstraint='System!System.User']/Property[Type='System!System.User']/FirstName$,

    A technician has been assigned to your incident request and will be in contact shortly.

    Details:

    Technician Assigned: $Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser' TypeConstraint='System!System.User']/Property[Type='System!System.User']/FirstName$ $Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser' TypeConstraint='System!System.User']/Property[Type='System!System.User']/LastName$

    Kind Regards,

    IT Support

    </1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Encoding$">utf-8</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/SeedClass$">System.WorkItem.Incident$3fc62adf-d590-ed19-587e-e029aecb738d</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Protocol$">SMTP</Property>

       </ObjectTemplate>

       <ObjectTemplate ID="IncidentAssignedToUserNotificationPrimaryOwnerTemplate" TypeID="CustomSystem_Notifications_Library!System.Notification.Template.SMTP">

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Subject$"><1033>[$Context/Property[Type='WorkItem!System.WorkItem']/Id$] - Assigned to $Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser' TypeConstraint='System!System.Domain.User']/Property[Type='System!System.Domain.User']/UserName$</1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Priority$">2</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/IsBodyHtml$">False</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Content$"><1033>

    </1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Encoding$">utf-8</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/SeedClass$">System.WorkItem.Incident$3fc62adf-d590-ed19-587e-e029aecb738d</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Protocol$">SMTP</Property>

       </ObjectTemplate>

       <ObjectTemplate ID="ActivityAssignedToUserNotificationTemplate" TypeID="CustomSystem_Notifications_Library!System.Notification.Template.SMTP">

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Subject$"><1033>Activity $Context/Property[Type='WorkItem!System.WorkItem']/Id$ is assigned to you</1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Priority$">2</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/IsBodyHtml$">False</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Content$"><1033>Details:

    Title: $Context/Property[Type='WorkItem!System.WorkItem']/Title$

    Description: $Context/Property[Type='WorkItem!System.WorkItem']/Description$

    Created By: $Context/Path[Relationship='WorkItem!System.WorkItemCreatedByUser' TypeConstraint='System!System.User']$?$DisplayName$?

    </1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Encoding$">utf-8</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/SeedClass$">System.WorkItem.Activity$3fc62adf-d590-ed19-587e-e029aecb738d</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Protocol$">SMTP</Property>

       </ObjectTemplate>

       <ObjectTemplate ID="ChangeRequestAssignedToUserNotificationTemplate" TypeID="CustomSystem_Notifications_Library!System.Notification.Template.SMTP">

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Subject$"><1033>Change Request $Context/Property[Type='WorkItem!System.WorkItem']/Id$ is assigned to you</1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Priority$">2</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/IsBodyHtml$">False</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Content$"><1033>Details:

    Title: $Context/Property[Type='WorkItem!System.WorkItem']/Title$

    Description: $Context/Property[Type='WorkItem!System.WorkItem']/Description$

    Created By: $Context/Path[Relationship='WorkItem!System.WorkItemCreatedByUser' TypeConstraint='System!System.User']$?$DisplayName$?

    </1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Encoding$">utf-8</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/SeedClass$">System.WorkItem.ChangeRequest$3fc62adf-d590-ed19-587e-e029aecb738d</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Protocol$">SMTP</Property>

       </ObjectTemplate>

       <ObjectTemplate ID="ProblemAssignedToUserNotificationTemplate" TypeID="CustomSystem_Notifications_Library!System.Notification.Template.SMTP">

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Subject$"><1033>Problem $Context/Property[Type='WorkItem!System.WorkItem']/Id$ is assigned to you</1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Priority$">2</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/IsBodyHtml$">False</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Content$"><1033>Details:

    Title: $Context/Property[Type='WorkItem!System.WorkItem']/Title$

    Description: $Context/Property[Type='WorkItem!System.WorkItem']/Description$

    Created By: $Context/Path[Relationship='WorkItem!System.WorkItemCreatedByUser' TypeConstraint='System!System.User']$?$DisplayName$?

    </1033></Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Encoding$">utf-8</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/SeedClass$">System.WorkItem.Problem$3fc62adf-d590-ed19-587e-e029aecb738d</Property>

         <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template']/Protocol$">SMTP</Property>

       </ObjectTemplate>

     </Templates>

     <LanguagePacks>

       <LanguagePack ID="ENU" IsDefault="true">

         <DisplayStrings>

           <DisplayString ElementID="Custom.WorkItem.Assignment.Workflow.Library">

             <Name>Custom WorkItem Assignment Workflow Library</Name>

           </DisplayString>

           <DisplayString ElementID="IncidentAssignedToUserAddRule">

             <Name>Incident Assignment Workflow</Name>

           </DisplayString>

           <DisplayString ElementID="IncidentAssignedToUserNotificationAffectedUserTemplate">

             <Name>Notification: Incident Assignment Affected User Template</Name>

           </DisplayString>

           <DisplayString ElementID="IncidentAssignedToUserNotificationPrimaryOwnerTemplate">

             <Name>Notification: Incident Assignment Primary Owner Template</Name>

           </DisplayString>

           <DisplayString ElementID="ActivityAssignedToUserAddRule">

             <Name>Activity Assignment Workflow</Name>

           </DisplayString>

           <DisplayString ElementID="ActivityAssignedToUserNotificationTemplate">

             <Name>Notification: Activity Assignment Template</Name>

           </DisplayString>

           <DisplayString ElementID="ChangeRequestAssignedToUserAddRule">

             <Name>Change Request Assignment Workflow</Name>

           </DisplayString>

           <DisplayString ElementID="ChangeRequestAssignedToUserNotificationTemplate">

             <Name>Notification: Change Request Assignment Template</Name>

           </DisplayString>

           <DisplayString ElementID="ProblemAssignedToUserAddRule">

             <Name>Problem Assignment Workflow</Name>

           </DisplayString>

           <DisplayString ElementID="ProblemAssignedToUserNotificationTemplate">

             <Name>Notification: Problem Assignment Template</Name>

           </DisplayString>

         </DisplayStrings>

       </LanguagePack>

     </LanguagePacks>

    </ManagementPack>

  • Hi Andrew - Thanks for your code! I tried importing it though and I get an error before import:

    Name cannot begin with the '1' character, hexadecimal value 0x31. Line 493, position 128.

  • Looks like I'll have to do some rearranging with the code.. Argghh XML is so touchy..

  • Update -- I've got the workflow working properly. Notifications going sent out to the Assigned User and the Affected User.

    Many thanks to you Ketan/Andrew!

  • @Mike - really strange i exported it straight out of SCSM 2012. I've uploaded the xml to my skydrive this may be simpler...

    skydrive.live.com/redir.aspx

  • Thanks Andrew and Mike.  @Andrew if it is ok with you I'll do an update to the blog post with link to your file

  • @Ketan - Yep fine with me, glad it worked :-)

  • With regards to the email notification template, I have formatted the text with the <Pre> tags (http://www.scsm.se/?p=542) - however, I would still like to make some adjustments

    1. Group the date, comment and analyst who made the action comment.

    2. Ignore action log items marked Private in the subscription.

    I've copied my notification/management pack to Skydrive.

    http://sdrv.ms/Pd4S1j

  • @Andy -

    1. Use the <Group> tag.

    2. Can't be done.

  • Hi

    Sorry if this has already been mentioned, but how can I do the exact same thing, but for a Service Request? I.E notify the new assigned to user upon change?

    Thanks :)

  • Dear all,

    Could you upload the management pack SCSM 2012 which send mail to Affected User and Assigned to User when a incident is assigned or re assigned ?

    Thank you.

  • Hello All,

    I am on SCSM 2012 UR2, i am trying to setup email notifications for the Analyst/User to gets an incident assigned  or re-assigned, I have followed the whole thread about 5 times but I don't see how to use this MP.

    I have imported the MP tha Andrew Francen uploaded on skydrive.live.com/redir.aspx but how can I make it work?

    Any help is much appreciated.

  • hi George

    This works fine on SCSM 2012 UR2. Ideally give it a spin in a test environment - I suggest that you just copy the xml at the end of the blog (step 5 above) and save it as ServiceManager.IncidentAssignmentChanges.Notification.xml

    Import into SCSM as a management pack (administration) and it will work straight away. If you want to change the details in the email message then configure the Assigned To User Notification Subscription template.

    Step 3, item vi allows you to change the Notification Template that is used. So you can create your own notification template and have the MP reference that instead of the default Assigned To User Notification Subscription template.

    Don't worry about version numbers - as long as your management packs are later versions (and they will be), then it will work.

    Cheers

    Graham

Page 5 of 6 (89 items) «23456