Notification to Service Owner when creating a Problem

April 17, 2013 Posted by Alexander Axberg

Hi,

In this blogpost I describe how to set up a mail notification workflow, that will send mail to the Service Owner when you add that service as an “Affected Service” when creating a new Problem.

In this example you can see that I’ve added the service E-Mail, and that the user “Administrator” is the current Business Service owner, who will recieve the mail.

affected_service

The trick is to create the relationship to “Service Owner” manually in XML, since you can’t select it from the console. The relation between the problem ticket and the serviceĀ is stored in “System.WorkItemAboutConfigItem”. The relationship looks like this:


<WorkflowArrayParameter Name="PrimaryUserRelationships" Type="string">
 <Item>$Context/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='System!System.Service']/Path[Relationship='System!System.ConfigItemOwnedByUser' TypeConstraint='System!System.User']$</Item>
</WorkflowArrayParameter>

 

Here is a complete Management Pack containing that workflow:


<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>ManagementPack.77a399a63b514841aae0529b06df0070</ID>
 <Version>7.5.2905.0</Version>
 </Identity>
 <Name>Problem Created</Name>
 <References>
 <Reference Alias="EnterpriseManagement">
 <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
 <Version>7.5.2905.0</Version>
 <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
 </Reference>
 <Reference Alias="CustomSystem_WorkItem_Library">
 <ID>System.WorkItem.Library</ID>
 <Version>7.5.2905.0</Version>
 <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
 </Reference>
 <Reference Alias="CustomSystem_Library">
 <ID>System.Library</ID>
 <Version>7.5.8501.0</Version>
 <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
 </Reference>
 <Reference Alias="EnterpriseManagement1">
 <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>
 <Version>7.5.2905.0</Version>
 <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
 </Reference>
 <Reference Alias="SystemCenter">
 <ID>Microsoft.SystemCenter.Library</ID>
 <Version>7.0.8432.0</Version>
 <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
 </Reference>
 <Reference Alias="SystemCenter1">
 <ID>Microsoft.SystemCenter.Subscriptions</ID>
 <Version>7.5.2905.0</Version>
 <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
 </Reference>
 </References>
 </Manifest>
 <Categories>
 <Category ID="Category.030336f5653f4e028b222b9bbe70bfd0" Value="EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack">
 <ManagementPackName>ManagementPack.77a399a63b514841aae0529b06df0070</ManagementPackName>
 <ManagementPackVersion>7.5.2905.0</ManagementPackVersion>
 </Category>
 <Category ID="Category.cdf0a383046642f6a47f1755c1e2978d" Target="NotificationSubscription_9fa9d9b3_80fd_4538_a82b_2a181deb61ee" Value="EnterpriseManagement1!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />
 </Categories>
 <Monitoring>
 <Rules>
 <Rule ID="NotificationSubscription_9fa9d9b3_80fd_4538_a82b_2a181deb61ee" Enabled="true" Target="SystemCenter!Microsoft.SystemCenter.SubscriptionWorkflowTarget" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
 <Category>System</Category>
 <DataSources>
 <DataSource ID="DS" TypeID="SystemCenter1!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">
 <Subscription>
 <InstanceSubscription Type="422afc88-5eff-f4c5-f8f6-e01038cde67f">
 <AddInstance />
 </InstanceSubscription>
 <PollingIntervalInSeconds>60</PollingIntervalInSeconds>
 <BatchSize>100</BatchSize>
 </Subscription>
 </DataSource>
 </DataSources>
 <WriteActions>
 <WriteAction ID="WA" TypeID="SystemCenter1!Microsoft.EnterpriseManagement.SystemCenter.Subscription.WindowsWorkflowTaskWriteAction">
 <Subscription>
 <VisibleWorkflowStatusUi>true</VisibleWorkflowStatusUi>
 <EnableBatchProcessing>true</EnableBatchProcessing>
 <WindowsWorkflowConfiguration>
 <AssemblyName>Microsoft.EnterpriseManagement.Notifications.Workflows</AssemblyName>
 <WorkflowTypeName>Microsoft.EnterpriseManagement.Notifications.Workflows.SendNotificationsActivity</WorkflowTypeName>
 <WorkflowParameters>
 <WorkflowParameter Name="SubscriptionId" Type="guid">$MPElement$</WorkflowParameter>
 <WorkflowArrayParameter Name="DataItems" Type="string">
 <Item>$Data/.$</Item>
 </WorkflowArrayParameter>
 <WorkflowArrayParameter Name="InstanceIds" Type="string">
 <Item>$Data/BaseManagedEntityId$</Item>
 </WorkflowArrayParameter>
 <WorkflowArrayParameter Name="TemplateIds" Type="string">
 <Item>ee7a7670-9f96-70b3-68f2-44b8f153006e</Item>
 </WorkflowArrayParameter>
 <WorkflowArrayParameter Name="PrimaryUserRelationships" Type="string">
 <Item>$Context/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='System!System.Service']/Path[Relationship='System!System.ConfigItemOwnedByUser' TypeConstraint='System!System.User']$</Item>
 </WorkflowArrayParameter>
 </WorkflowParameters>
 <RetryExceptions />
 <RetryDelaySeconds>60</RetryDelaySeconds>
 <MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>
 </WindowsWorkflowConfiguration>
 </Subscription>
 </WriteAction>
 </WriteActions>
 </Rule>
 </Rules>
 </Monitoring>
 <LanguagePacks>
 <LanguagePack ID="ENU" IsDefault="false">
 <DisplayStrings>
 <DisplayString ElementID="ManagementPack.77a399a63b514841aae0529b06df0070">
 <Name>Problem Created</Name>
 </DisplayString>
 <DisplayString ElementID="NotificationSubscription_9fa9d9b3_80fd_4538_a82b_2a181deb61ee">
 <Name>Problem Created</Name>
 </DisplayString>
 </DisplayStrings>
 </LanguagePack>
 <LanguagePack ID="SVE" IsDefault="false">
 <DisplayStrings>
 <DisplayString ElementID="NotificationSubscription_9fa9d9b3_80fd_4538_a82b_2a181deb61ee">
 <Name>Problem Created</Name>
 </DisplayString>
 </DisplayStrings>
 </LanguagePack>
 </LanguagePacks>
 </ManagementPack>

2 Responses to Notification to Service Owner when creating a Problem

  1. Check your XML snippets )

Leave a Reply

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

*