locked
How to CC Primary Owner on notification email? RRS feed

  • Question

  • The notification for just Assigned To User works fine.  When I import the MP with the below it erros out.  I am trying to send the notification to both Assigned to User and Primary Owner:

    <WorkflowParameter Name="InstanceId" Type="guid">$Data/BaseManagedEntityId$</WorkflowParameter>
                      <WorkflowArrayParameter Name="UserRelationshipIdList" Type="guid">
                        <Item>$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$</Item>
    		    <Item>$MPElement[Name='WorkItem!System.WorkItem.IncidentPrimaryOwner']$</Item>
    		    </WorkflowArrayParameter>

    This errors out on import:

    The management pack import failed. 
    Errors (1):
    The configuration specified for Module WA is not valid.
    : Cannot find specified MPElement WorkItem!System.WorkItem.IncidentPrimaryOwner in expression: $MPElement[Name='WorkItem!System.WorkItem.IncidentPrimaryOwner']$
    Cannot find ManagementPackElement [Type=ManagementPackElement, ID=System.WorkItem.IncidentPrimaryOwner] in management pack ManagementPack:[Name=System.WorkItem.Library, KeyToken=31bf3856ad364e35, Version=7.0.6555.0].

      Any ideas?

    Friday, November 30, 2012 10:18 PM

All replies

  • System.WorkItem.IncidentPrimaryOwner relationship stored in System.WorkItem.Incident management pack. So you must add reference to this MP and change alias from 'WorkItem! to alias of incident MP. 

    SCSMSolutions
    email: freemanru (at) gmail (dot) com

    Monday, December 3, 2012 7:41 PM
  • <Reference Alias="IncidentLibrary">
    <ID>System.WorkItem.Incident.Library</ID>
    <Version>7.0.6555.0</Version>
    <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    
    
    
    <WorkflowArrayParameter Name="UserRelationshipIdList" Type="guid">
    <Item>$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$</Item>
    <Item>$MPElement[Name='IncidentLibrary!System.WorkItem.IncidentPrimaryOwner']$</Item>
    </WorkflowArrayParameter>

    Ok, I modified the alias to point to the correct MP. My modified MP imports with no errors but does not work.  I can check the status of the workflow and see that it runs but no email is recieved. If I remove the Primary Owner entry the workflow runs as it should. It is only when I add the above entry does it fail.

    Thanks!

    Monday, December 3, 2012 10:10 PM
  • Check the Operations Manager log on your server.

    SCSMSolutions
    email: freemanru (at) gmail (dot) com

    Monday, December 3, 2012 11:40 PM
  • Nope, no errors in the Ops log.

    The workflow log is useless, is there any other way to see what is happening under the hood?

    Tuesday, December 4, 2012 2:06 PM
  • Hi,

    the Primary Owner is wrong - primary Owner is specified with:

    "$MPElement[Name='CoreIncident!System.WorkItem.IncidentPrimaryOwner']$"

    You also have to change the WorkflowArrayParameter to get the PrimaryOwner notfified with:

                      <WorkflowArrayParameter Name="UserAliasOrRelationships" Type="string">
                        <Item>42179172-3d24-cfc8-3944-b0a18f550214</Item>
                      </WorkflowArrayParameter>
    

    Peter Forster | MVP Virtual Machine 2002-2011 | Austria |

    Tuesday, December 4, 2012 7:02 PM
  • Hi,

    the Primary Owner is wrong - primary Owner is specified with:

    "$MPElement[Name='CoreIncident!System.WorkItem.IncidentPrimaryOwner']$"

    You also have to change the WorkflowArrayParameter to get the PrimaryOwner notfified with:

                      <WorkflowArrayParameter Name="UserAliasOrRelationships" Type="string">
                        <Item>42179172-3d24-cfc8-3944-b0a18f550214</Item>
                      </WorkflowArrayParameter>

    Peter Forster | MVP Virtual Machine 2002-2011 | Austria |

    Peter,

    What does your CoreIncident! reference? 

    Are you saying it needs both a UserAliasOrRelationships and a UserRelationshipIdList Array?

    Thanks

    John

    Tuesday, December 4, 2012 7:41 PM
  • Hi,

    here you have our MP - this was built up on the Assigned To User Notification but will notify the Primary Owner when this field is being updated:

    <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.IncidentAssignmentPrimOwnerChanges.Notification</ID>
          <Version>7.0.6555.2</Version>
        </Identity>
        <Name>Incident Primary Owner Assignment Changes Notification Workflow</Name>
        <References>
          <Reference Alias="WorkItem">
            <ID>System.WorkItem.Library</ID>
            <Version>7.0.6555.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="Incident">
            <ID>ServiceManager.IncidentManagement.Library</ID>
            <Version>7.0.6555.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="CoreIncident">
            <ID>System.WorkItem.Incident.Library</ID>
            <Version>7.0.6555.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="SystemCenter">
            <ID>Microsoft.SystemCenter.Library</ID>
            <Version>7.0.6555.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="SystemCenter1">
            <ID>Microsoft.SystemCenter.Subscriptions</ID>
            <Version>7.0.6555.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="Administration">
            <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>
            <Version>7.0.6555.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="System">
            <ID>System.Library</ID>
            <Version>7.0.6555.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
        </References>
      </Manifest>
      <Categories>
        <Category ID="IncidentConfigurationMPSolutionCategory" Value="Incident!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack.Solution.IncidentManagement">
          <ManagementPackName>ServiceManager.IncidentAssignmentPrimOwnerChanges.Notification</ManagementPackName>
          <ManagementPackVersion>7.0.6555.0</ManagementPackVersion>
        </Category>
        <Category ID="Category.IncidentAssignmentPrimOwnerChanges" Target="IncidentAssignmentPrimOwnerChanges" Value="Administration!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />
      </Categories>
      <Monitoring>
        <Rules>
          <Rule ID="IncidentAssignmentPrimOwnerChanges" 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='CoreIncident!System.WorkItem.IncidentPrimaryOwner']$" SourceType="$MPElement[Name='CoreIncident!System.WorkItem.Incident']$" TargetType="$MPElement[Name='System!System.Domain.User']$">
                    <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>0D92BC93-F267-56CA-FA0D-F2B937C5651F</Item>
                      </WorkflowArrayParameter>
                      <WorkflowArrayParameter Name="UserAliasOrRelationships" Type="string">
                        <Item>42179172-3d24-cfc8-3944-b0a18f550214</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.IncidentAssignmentPrimOwnerChanges.Notification">
              <Name>Service Manager Incident Assignment Changes Primary Owner Notification Workflow</Name>
              <Description>Service Manager Incident Assignement Primary Owner Changes Workflow</Description>
            </DisplayString>
            <DisplayString ElementID="IncidentAssignmentPrimOwnerChanges">
              <Name>Incident Assignement Primary Owner Notification</Name>
            </DisplayString>
          </DisplayStrings>
        </LanguagePack>
      </LanguagePacks>
    </ManagementPack>

     


    Peter Forster | MVP Virtual Machine 2002-2011 | Austria |

    Tuesday, December 4, 2012 7:45 PM
  • Thanks Peter, that's a little different that I am looking to do.  I am looking to CC the Primary Owner on this MP.

    Your CoreIncident points to the same MP as my reference.

    Tuesday, December 4, 2012 7:57 PM
  • Hi,

    sorry - missed the "CC" in the title.


    Peter Forster | MVP Virtual Machine 2002-2011 | Austria |

    Tuesday, December 4, 2012 8:02 PM
  • The weird thing is if I put one or the other of these:

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

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

    in it sends the email.  If I put both in, it doesn't send any mail.  It's something about having two items in there kills it.

    Tuesday, December 4, 2012 9:17 PM
  • Hi All !

    Im missing the focus on the main question which is CC E-mail.

    I dont think its possible to send cc Mails with the standard notification channel.

    if you want to do that you have to love this with powershell and the Send-MailMessage Command.

    R.


    Problem talk creates problems, solution talk creates solutions (Steve deShazer)

    Tuesday, December 4, 2012 10:08 PM
  • Hi, I am not really looking to "CC" I am just looking to send to Primary Owner as well as Assigned to.

    Thanks!

    Tuesday, December 4, 2012 10:12 PM
  • Hi,

    so you want to send an e-mail when the Assigned to field is changed. The e-mail should be sen't to the new Assigned To User (which currently works) and you want to send the Primary Owner an e-mail too, right?

    You can for use my MP code (as it has new workflow names) and change the following settings:

    Change this line to Assigned to user - this is the trigger field. So whenever this field will be changed an e-mail will be generated.

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

    Within my MP the UseAliasOrRelationship 42179172-3d24-cfc8-3944-b0a18f550214 defines the primary Owner - so the trigger is the Assigned to User field and the 42179172-3d24-cfc8-3944-b0a18f550214 defines the mail recipient.

    Do not forget to edit the Notification Template to your GUID - I've uploaded my MP in the meanwhile to the TechNet Gallery: http://gallery.technet.microsoft.com/Primary-Owner-Assignment-9b0a7405

    This should work as I had configured your requirement by mistake this week.


    Peter Forster | MVP Virtual Machine 2002-2011 | Austria |

    Wednesday, December 5, 2012 3:49 PM