Custom Notification workflow on activity assignment or reassignment

Custom Notification workflow on activity assignment or reassignment

  • Comments 11
  • Likes

This blog posts demonstrates how to configure a notification workflow in Service Manager that sends out notifications on assignment or reassignment of an Activity.

1.       Steps for creating this custom workflow:

1.       Create a new XML file – Name it:  Custom.ActivityWorkflows.xml

a.       The name of the file should match the mp. If you decide to name your management pack something different the file name will have to match

2.       Copy and paste the complete XML provided in section 2.

3.       Save the File

4.       Last Step is to Import the management pack

a.       Service Manager Console

b.      Open Go to Administration -> Management Packs

c.       Click on “Import” in the task pane

d.      Click “Add” 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.

5.       Verification

a.       Open Service Manager Console

b.      Go to Administration->Workflows->Status

c.       You should see “Assigned to user added to activity” in the view pane as shown below

Activity assigned to user workflow

d.       Assign an activity to a user and make sure the mail is sent

2.       Complete XML of the management pack:                   

Please note that this is for the RC build.

<ManagementPack ContentReadable="true" SchemaVersion="1.1" OriginalSchemaVersion="1.1" xmlns:xsd="" xmlns:xsl="">






    <Name>Custom Activity Workflows</Name>


      <Reference Alias="WorkItem">





      <Reference Alias="ActivityManagement">





      <Reference Alias="EnterpriseManagement1">





      <Reference Alias="EnterpriseManagement">





      <Reference Alias="System">





      <Reference Alias="CoreActivity">





      <Reference Alias="SystemCenter">





      <Reference Alias="CustomSystem_Notifications_Library">








    <Category ID="Category.Custom.ActivityWorkflows.ManagementPack" Value="EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack">




    <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" />




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



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


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

                <AddRelationship />








          <WriteAction ID="WA" TypeID="SystemCenter!Microsoft.EnterpriseManagement.SystemCenter.Subscription.WindowsWorkflowTaskWriteAction">







                  <WorkflowParameter Name="InstanceId" Type="guid">$Data/BaseManagedEntityId$</WorkflowParameter>

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



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




                <RetryExceptions />











    <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$?


      <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>




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


        <DisplayString ElementID="Custom.ActivityWorkflows">

          <Name>Custom Activity Workflows</Name>


        <DisplayString ElementID="ActivityAssignedToUserAddRule">

          <Name>Assigned to user added to activity</Name>


        <DisplayString ElementID="ActivityAssignedToUserNotificationTemplate">

          <Name>Activity assigned to user template</Name>







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

This section requires advanced understanding of SM and is not needed to achieve the goal of sending proper notification on Activity assignment. You should skip this section is you are only interested in the “how to get it to work”.

1.        Manifest Section

a.       The references section identifies the Management Pack and lists the dependencies for this management pack

b.      Aliases defined for these references make 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.        ObjectTemplate

a.       This contains an activity notification template. I have added this in this MP to provide a notification template for Activity.

b.      UI provides easy editing of the template content: Go to Administration->Notifications->Templates, select “Activity assigned to user template” and click on the “Properties”

Activity Notification Template

4.        Monitoring Section

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

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

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

                                  ii.      “Assigned To” user is a relationship on the Workitem (base class for Activity) – 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 Activity for which a “AssignedTo” Relationship was added


RelType="$MPElement[Name='WorkItem!System.WorkItemAssignedToUser']$" Name of the relationship

SourceType="$MPElement[Name='CoreActivity!System.WorkItem.Activity']$" Type of object (restrict it to Activity and derived classes)

TargetType="$MPElement[Name='System!System.Domain.User']$"> Type of object (restrict it to Domain User and derived classes)

                <AddRelationship /> When a new instance of relationship is 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.

                                  ii.      In this case we are re-using a workflow that is used by “Change Request Event Workflow Configuration” and “Activity Event Workflow Configuration”.

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

<AssemblyName>Microsoft.EnterpriseManagement.WorkflowFoundation</AssemblyName>                <WorkflowTypeName>Microsoft.EnterpriseManagement.WorkflowFoundation.ConfigurationWorkflow</WorkflowTypeName>

                                iv.      The workflow takes the following parameters.

1.       InstanceId – The identifier for your relationship instance. This is required.

<WorkflowParameter Name="InstanceId" Type="guid">$Data/BaseManagedEntityId$</WorkflowParameter>

2.       For notifications you need the following parameters.

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



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




This is an array parameter. So you can specify multiple relationships and notification templates.

The order of the items will determine the template used for the relationship. The first notification template will be used for the first relationship, the second template will be used for the second relationship and so on.. The number of items in both array parameters above should be the same.

 If your relationship or notification template is an a different unsealed mp you will have to put the guid Id with the Item tag above.

 In order to get the GUID for your own template from the DB you can use a simple query. "select Objecttemplateid from ObjectTemplate where ObjectTemplateName='<name of the template>'

3.       For applying template the workflow takes the following parameter.

   <WorkflowParameter Name="TemplateId" Type="guid"> MPElement[Name='<Name of template>']</WorkflowParameter>

You can also use this workflow to apply a template to the activity. The template is applied before the mail is sent.

5.        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


4.       How to perform a similar task for a different type:

You can use the above workflow for other types as well.

For example, if you want do similar task for a Change Request assignment change.

You need to create or use an existing change request notification template and replace references to System.WorkItem.Activity with System.WorkItem.ChangeRequest. You will have to add a reference to the System.WorkItem.ChangeRequest.Library library in the Manifest->References section and use the correct alias when refering to the type.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi

    Has anyone tested this on RTM?



  • Good afternoon,

    When I attempt to use this workflow, I receive the following exception:

    Cannot resolve identifier WIGroup!System.WorkItem in the context of management pack Custom.ActivityWorkflows. Unknown alias: WIGroup

    This occurs at the following states in the workflow:







    Thoughts/suggestions?  I would like to have an email sent to Assigned To users of Activities when it changes.

  • Hi Amit,

    I am stuck. Can you clearify which part I will change on your xml exactly? I have created a template called "Manual Activity Template" saved in ServiceManager.ActivityManagement.Configuration.xml. So which part do I need to change?

  • Hello

    Thanks for the usefull article

    I have SCSM SP1

    I have tried to use it as is , it is imported successfully but not sending email , and it is showing no warning or error in the status of workflow

    I have deleted and edit the version to match the SP1 version but it doesn't work even


  • Hello, I have SCSM 2010 SP1 + CU1.

    What I must change in Custom.ActivityWorkflows.xml to make it work on my version ? (this xml in blog is created for SCSM 2010 RC)

    Thanks in advance.

    Best regards,


  • So does this work in SCSM 2010 Sp1 or not? Anybody getting it to work?

  • I have a working solution for SCSM 2010 SP1 CU1 that covers notifications for all 4 work items here:

  • Can anyone confirm the above approach works for SCSM 2012 SP1 ?

  • @Wyatt Wong

    If we are talking about _approach_, yes, it works fine for SCSM 2012 SP1 UR2.

    _Approach_ means in a few words:

    - using of "RelationshipSubscription" to track "WorkItemAssignedToUser" property

    - manual editing and troubleshooting of management pack including update for all names and aliases

    - own workflow that could combine different triggers to fire notification process (e.g. custom extended Activity class to keep flags related to assignment or re-assignment)



  • Hello!

    I'm using this on SCSM 2012 SP1 and it's working fine!

    Is it possible to add a new criteria to just send the notification for assignment change IF the workitem is active?


  • Hi Amit,

    I'm looking to add a condition that indicates not to send the notification when the activity is in pending status. Is this something I'd be able to paste into the xml mp?