locked
Add Reviewers notification RRS feed

  • Question

  • Trying to create a MP or notification subscription to send an e-mail when a review activity is in progress and they have been added to it. What happens now is that if a the change request is created the assigned to user needs to add all the users in the activities before starting things off. So if they incorrectly add the wrong user in the review activity or manual activity nothing is sent since the activity is already in progress when the wrong reviewer notifies us that they do not need to review it. Is there a way to setup a sebscription to monitor this if a new reviewer is added while in progress?

    This is what I have so far but if anyone could assist I would greatly appreciate it.

    <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.bc41636a30cd49088f7731668800bffe</ID>
          <Version>7.5.1561.0</Version>
        </Identity>
        <Name>New Reviewer Added to Review Activity</Name>
        <References>
          <Reference Alias="EnterpriseManagement">
            <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
            <Version>7.5.1561.116</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="CustomSystem_WorkItem_Library">
            <ID>System.WorkItem.Library</ID>
            <Version>7.5.1561.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="CustomSystem_WorkItem_Activity_Library">
            <ID>System.WorkItem.Activity.Library</ID>
            <Version>7.5.1561.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="SystemCenter">
            <ID>Microsoft.SystemCenter.Library</ID>
            <Version>7.0.8427.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="SystemCenter1">
            <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.79187e5c740d4b92965c66a16d1feed6" Value="EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack">
          <ManagementPackName>ManagementPack.bc41636a30cd49088f7731668800bffe</ManagementPackName>
          <ManagementPackVersion>7.5.1561.0</ManagementPackVersion>
        </Category>
        <Category ID="ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration540153c5_59ce_4692_a016_4156ff5e05ed.Category" Target="Template_5fbc6d17b6fc4621a2c73600b9741ea3" Value="EnterpriseManagement1!ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration" />
        <Category ID="Category.81f009815f244198acfd9c76869f3310" Target="NotificationSubscription_cf222c08_b586_4d63_943c_bc268abbdc7f" Value="EnterpriseManagement1!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />
      </Categories>
      <Monitoring>
        <Rules>
          <Rule ID="NotificationSubscription_cf222c08_b586_4d63_943c_bc268abbdc7f" 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="2f28a9ae-0e94-c895-c087-b222b231dd46">
                    <UpdateInstance>
                      <Criteria>
                        <Expression>
                          <SimpleExpression>
                            <ValueExpression>
                              <Property State="Post">$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/ReviewerId$</Property>
                            </ValueExpression>
                            <Operator>Equal</Operator>
                            <ValueExpression>
                              <Value>[new]</Value>
                            </ValueExpression>
                          </SimpleExpression>
                        </Expression>
                      </Criteria>
                    </UpdateInstance>
                  </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>48716aef-726f-37bb-8cbd-50f21846ce43</Item>
                      </WorkflowArrayParameter>
                      <WorkflowArrayParameter Name="PrimaryUserRelationships" Type="string">
                        <Item>$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAssignedToUser' TypeConstraint='CustomSystem_Library!System.User']$</Item>
                      </WorkflowArrayParameter>
                    </WorkflowParameters>
                    <RetryExceptions />
                    <RetryDelaySeconds>60</RetryDelaySeconds>
                    <MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>
                  </WindowsWorkflowConfiguration>
                </Subscription>
              </WriteAction>
            </WriteActions>
          </Rule>
        </Rules>
      </Monitoring>
      <Templates>
        <ObjectTemplate ID="Template_5fbc6d17b6fc4621a2c73600b9741ea3" TypeID="CustomSystem_Notifications_Library!System.Notification.Template.SMTP">
          <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Subject$">&lt;1033&gt;Test&lt;/1033&gt;</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$">&lt;1033&gt;test&lt;/1033&gt;</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.Reviewer$2f28a9ae-0e94-c895-c087-b222b231dd46</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="ManagementPack.bc41636a30cd49088f7731668800bffe">
              <Name>New Reviewer Added to Review Activity</Name>
            </DisplayString>
            <DisplayString ElementID="Template_5fbc6d17b6fc4621a2c73600b9741ea3">
              <Name>New Reviewer Added to Review Activity</Name>
            </DisplayString>
            <DisplayString ElementID="NotificationSubscription_cf222c08_b586_4d63_943c_bc268abbdc7f">
              <Name>New Reviewer Added to review activity</Name>
            </DisplayString>
          </DisplayStrings>
        </LanguagePack>
      </LanguagePacks>
    </ManagementPack>


    Help

    Friday, January 4, 2013 4:02 PM

Answers

All replies

  • Hi,

    Did you manage this or still have the same problem ?

    Regards,


    Mohamed Fawzi | http://fawzi.wordpress.com

    Monday, February 25, 2013 10:39 AM
  • No not yet.

    Help

    Monday, February 25, 2013 12:17 PM
  • Okay..Since I am facing the same problem let me give you some hints

    1- You can create a new Subscription with Class "Reviewer" Condition "When new Object from this class created" and with no additional Criteria ...And specify Reviewer "Is User" in the notification

    Problem: That you can not include any information about the CR or RA in the mail template

    2- You can Go with your MP

    <InstanceSubscription Type="2f28a9ae-0e94-c895-c087-b222b231dd46">
                    <UpdateInstance>
                      <Criteria>
                        <Expression>
                          <SimpleExpression>
                            <ValueExpression>
                              <Property State="Post">$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/ReviewerId$</Property>
                            </ValueExpression>
                            <Operator>Equal</Operator>
                            <ValueExpression>
                              <Value>[new]</Value>
                            </ValueExpression>
                          </SimpleExpression>
                        </Expression>
                      </Criteria>
                    </UpdateInstance>

    But the problem that There is not any thing for ReviewerId called [new]

    You can try       <Operator>IsNotEmpty</Operator>


    Mohamed Fawzi | http://fawzi.wordpress.com


    • Edited by M Fawzi Monday, February 25, 2013 12:43 PM
    Monday, February 25, 2013 12:35 PM
  • also you can try

           <Criteria>
                        <Expression>
                          <And>
                            <Expression>
                              <UnaryExpression>
                                <ValueExpression>
                                  <Property State="Pre">$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewerIsUser' TypeConstraint='CustomSystem_Library!System.Domain.User']/Property[Type='CustomSystem_Library!System.Domain.User']/UserName$</Property>
                                </ValueExpression>
                                <Operator>IsNull</Operator>
                              </UnaryExpression>
                            </Expression>
                            <Expression>
                              <UnaryExpression>
                                <ValueExpression>
                                  <Property State="Post">$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewerIsUser' TypeConstraint='CustomSystem_Library!System.Domain.User']/Property[Type='CustomSystem_Library!System.Domain.User']/UserName$</Property>
                                </ValueExpression>
                                <Operator>IsNotNull</Operator>
                              </UnaryExpression>
                            </Expression>
                          </And>
                        </Expression>
                      </Criteria>


    Mohamed Fawzi | http://fawzi.wordpress.com

    Monday, February 25, 2013 1:22 PM
  • This one worked for me, Try it

    <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>Custom.ActivityWorkflows</ID>
          <Version>7.5.2905.0</Version>
        </Identity>
        <Name>Custom Activity Workflows</Name>
        <References>
          <Reference Alias="WorkItem">
            <ID>System.WorkItem.Library</ID>
            <Version>7.5.2905.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="ActivityManagement">
            <ID>ServiceManager.ActivityManagement.Library</ID>
            <Version>7.5.2905.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="EnterpriseManagement">
            <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
            <Version>7.5.2905.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="System">
            <ID>System.Library</ID>
            <Version>7.5.2905.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="CoreActivity">
            <ID>System.WorkItem.Activity.Library</ID>
            <Version>7.5.2905.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="SystemCenter">
            <ID>Microsoft.SystemCenter.Subscriptions</ID>
            <Version>7.5.2905.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="SystemCenter1">
            <ID>Microsoft.SystemCenter.Library</ID>
            <Version>7.0.8432.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="CustomSystem_Notifications_Library">
            <ID>System.Notifications.Library</ID>
            <Version>7.5.2905.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
        </References>
      </Manifest>
      <Categories>
        <Category ID="Category.Custom.ActivityWorkflows.ManagementPack" Value="EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack">
          <ManagementPackName>Custom.ActivityWorkflows</ManagementPackName>
          <ManagementPackVersion>7.5.2905.0</ManagementPackVersion>
        </Category>
        <Category ID="Category.ActivityAssignedToUserAddRule" Target="ActivityAssignedToUserAddRule" Value="EnterpriseManagement1!Microsoft.EnterpriseManagement.ServiceManager.Rules.WorkflowSubscriptions" />
        <Category ID="ServiceManager.Console.NotificationManagement.NotificationTemplates.ActivityAssignedToUserNotificationTemplate.Category" Target="ActivityAssignedToUserNotificationTemplate" Value="EnterpriseManagement1!ServiceManager.Console.NotificationManagement.NotificationTemplates.Enumeration" />
      </Categories>
      <Monitoring>
        <Rules>
          <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='CoreActivity!System.ReviewActivityHasReviewer']$" SourceType="$MPElement[Name='CoreActivity!System.WorkItem.Activity.ReviewActivity']$" TargetType="$MPElement[Name='CoreActivity!System.Reviewer']$">
                    <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.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>746fd65a-9050-4d58-507c-21d83c059aca</Item>
                      </WorkflowArrayParameter>
                      <WorkflowArrayParameter Name="PrimaryUserRelationships" Type="string">
                        <Item>$Context/Path[Relationship='CoreActivity!System.ReviewActivityHasReviewer' TypeConstraint='CoreActivity!System.Reviewer']/Path[Relationship='CoreActivity!System.ReviewerIsUser' TypeConstraint='System!System.User']$</Item>
                      </WorkflowArrayParameter>
                    </WorkflowParameters>
                    <RetryExceptions />
                    <RetryDelaySeconds>60</RetryDelaySeconds>
                    <MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>
                  </WindowsWorkflowConfiguration>
                </Subscription>
              </WriteAction>
            </WriteActions>
          </Rule>
        </Rules>
      </Monitoring>
      <Templates>
        <ObjectTemplate ID="ActivityAssignedToUserNotificationTemplate" TypeID="CustomSystem_Notifications_Library!System.Notification.Template.SMTP">
          <Property Path="$Context/Property[Type='CustomSystem_Notifications_Library!System.Notification.Template.SMTP']/Subject$">&lt;1033&gt;Activity $Context/Property[Type='WorkItem!System.WorkItem']/Id$ is assigned to you&lt;/1033&gt;</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$">&lt;1033&gt;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$?
    &lt;/1033&gt;</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>
      </Templates>
      <LanguagePacks>
        <LanguagePack ID="ENU" IsDefault="true">
          <DisplayStrings>
            <DisplayString ElementID="Custom.ActivityWorkflows">
              <Name>Custom Activity Workflows</Name>
            </DisplayString>
            <DisplayString ElementID="ActivityAssignedToUserAddRule">
              <Name>Assigned to user added to activity</Name>
            </DisplayString>
            <DisplayString ElementID="ActivityAssignedToUserNotificationTemplate">
              <Name>Activity assigned to user template</Name>
            </DisplayString>
          </DisplayStrings>
        </LanguagePack>
      </LanguagePacks>
    </ManagementPack>


    Mohamed Fawzi | http://fawzi.wordpress.com

    Monday, February 25, 2013 3:57 PM
  • Thanks Mohamed - I will try it out and let you know.

    Help

    Monday, February 25, 2013 10:48 PM
  • I just made update the MP, Kindly find details here

    Notification Workflow on Review Activity Assignment-Reassignment

    http://fawzi.wordpress.com/2013/02/25/notification-workflow-on-review-activity-assignment/


    Mohamed Fawzi | http://fawzi.wordpress.com

    • Proposed as answer by M Fawzi Wednesday, February 27, 2013 4:40 PM
    • Marked as answer by needhelp..... _ Wednesday, February 27, 2013 10:57 PM
    Tuesday, February 26, 2013 8:07 AM