Create a view of all Activities that are a part of a Change Request and see the Change Request information in the view columns.

Create a view of all Activities that are a part of a Change Request and see the Change Request information in the view columns.

  • Comments 3
  • Likes

There have been some requests for viewing the parent work item (particularly Change Request) information along with the activity information. This blog post demonstrates how to create a view for all activities that are a part of a Change Request, where the Change Request status is not equal to Closed.

1.      Steps for creating this view.

1.       Create a new XML file – Name it:  ActivityManagement.Views

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.      Change the version number in the file with version to match your build.

a.      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:   <Version>7.0.5244.0</Version>

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

4.      Save the File

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

h.      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 Workitems->Activity Management->All Activities in Change Request view.

c.       Verify data in the view is correct.

 "All Activities in Change Request" view

d.      To see Activities grouped by the Change request you will have to Right Click on the header of the view and select Group By->Change request

 Group By

2.      Complete XML of the management pack:

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>ActivityManagement.Views</ID>

      <Version>7.0.5244.0</Version>

    </Identity>

    <Name>Activity Management Views</Name>

    <References>

      <Reference Alias="System">

        <ID>System.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="WorkItem">

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

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="CoreChange">

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

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="Activity">

        <ID>ServiceManager.ActivityManagement.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="CoreActivity">

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

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

      <Reference Alias="SMConsole">

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

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

    </References>

  </Manifest>

  <TypeDefinitions>

    <EntityTypes>

      <TypeProjections>

        <TypeProjection ID="System.WorkItem.ActivityChangeRequestViewProjection" Accessibility="Public" Type="CoreActivity!System.WorkItem.Activity">

          <Component Alias="ActivityAssignedTo" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" />

          <Component Alias="ParentWorkItem" Path="$Target/Path[Relationship='CoreActivity!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CoreChange!System.WorkItem.ChangeRequest']$" />

        </TypeProjection>

      </TypeProjections>

    </EntityTypes>

  </TypeDefinitions>

  <Categories>

    <Category ID="ActivityManagementViewsMPSolutionCategory" Value="Activity!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack.Solution.ActivityManagement">

      <ManagementPackName>ActivityManagement.Views</ManagementPackName>

      <ManagementPackVersion>7.0.5244.0</ManagementPackVersion>

    </Category>

    <Category ID="ActivityManagement.Categories.AllActivitiesinChangeRequest" Target="ActivityManagement.Views.AllActivitiesinChangeRequest" Value="SMConsole!Microsoft.EnterpriseManagement.ServiceManager.UI.Console.ViewTasks" />

  </Categories>

  <Presentation>

    <Views>

      <View ID="ActivityManagement.Views.AllActivitiesinChangeRequest" Accessibility="Public" Enabled="true" Target="CoreActivity!System.WorkItem.Activity" TypeID="SMConsole!GridViewType" Visible="true">

        <Category>NotUsed</Category>

        <Data>

          <Adapters>

            <Adapter AdapterName="dataportal:EnterpriseManagementObjectProjectionAdapter">

              <AdapterAssembly>Microsoft.EnterpriseManagement.UI.SdkDataAccess</AdapterAssembly>

              <AdapterType>Microsoft.EnterpriseManagement.UI.SdkDataAccess.DataAdapters.EnterpriseManagementObjectProjectionAdapter</AdapterType>

            </Adapter>

            <Adapter AdapterName="viewframework://Adapters/AdvancedList">

              <AdapterAssembly>Microsoft.EnterpriseManagement.UI.ViewFramework</AdapterAssembly>

              <AdapterType>Microsoft.EnterpriseManagement.UI.ViewFramework.AdvancedListSupportAdapter</AdapterType>

            </Adapter>

          </Adapters>

          <ItemsSource>

            <AdvancedListSupportClass DataTypeName="" AdapterName="viewframework://Adapters/AdvancedList" FullUpdateAdapter="dataportal:EnterpriseManagementObjectProjectionAdapter" DataSource="mom:ManagementGroup" IsRecurring="true" RecurrenceFrequency="{x:Static s:Int32.MaxValue}" FullUpdateFrequency="1" Streaming="true" xmlns="clr-namespace:Microsoft.EnterpriseManagement.UI.ViewFramework;assembly=Microsoft.EnterpriseManagement.UI.ViewFramework" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib">

              <AdvancedListSupportClass.Parameters>

                <QueryParameter Parameter="TypeProjectionId" Value="$MPElement[Name='System.WorkItem.ActivityChangeRequestViewProjection']$" />

              </AdvancedListSupportClass.Parameters>

            </AdvancedListSupportClass>

          </ItemsSource>

          <Criteria>

            <QueryCriteria Adapter="omsdk://Adapters/Criteria" xmlns="http://tempuri.org/Criteria.xsd">

              <Criteria>

                <FreeformCriteria>

                  <Freeform>

                    <Criteria xmlns="http://Microsoft.EnterpriseManagement.Core.Criteria/">

                      <Expression>

                        <SimpleExpression>

                          <ValueExpressionLeft>

                            <Property>$Context/Path[Relationship='CoreActivity!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CoreChange!System.WorkItem.ChangeRequest']/Property[Type='CoreChange!System.WorkItem.ChangeRequest']/Status$</Property>

                          </ValueExpressionLeft>

                          <Operator>NotEqual</Operator>

                          <ValueExpressionRight>

                            <Value>$MPElement[Name="CoreChange!ChangeStatusEnum.Closed"]$</Value>

                          </ValueExpressionRight>

                        </SimpleExpression>

                      </Expression>

                    </Criteria>

                  </Freeform>

                </FreeformCriteria>

              </Criteria>

            </QueryCriteria>

          </Criteria>

        </Data>

        <Presentation>

          <Columns>

            <mux:ColumnCollection xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mux="http://schemas.microsoft.com/SystemCenter/Common/UI/Views/GridView" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:datebinding="clr-namespace:Microsoft.EnterpriseManagement.UI.SdkDataAccess.Common;assembly=Microsoft.EnterpriseManagement.UI.SdkDataAccess">

              <mux:Column Name="id" DisplayMemberBinding="{Binding Path=Id}" Width="100" DisplayName="Header_Id" Property="Id$ReturnValueAsBigInt$" DataType="s:Int32" />

              <mux:Column Name="title" DisplayMemberBinding="{Binding Path=Title}" Width="200" DisplayName="Header_Title" Property="Title" DataType="s:String" />

              <mux:Column Name="parentDisplayName" DisplayMemberBinding="{Binding Path=ParentWorkItem/DisplayName}" Width="200" DisplayName="Header_Parent_DisplayName" Property="ParentWorkItem/DisplayName" DataType="s:String" />

              <mux:Column Name="parentStatus" DisplayMemberBinding="{Binding Path=ParentWorkItem/Status.DisplayName}" Width="100" DisplayName="Header_Parent_Status" Property="ParentWorkItem/Status.DisplayName" DataType="s:String" />

              <mux:Column Name="aDisplayName" DisplayMemberBinding="{Binding Path=ActivityAssignedTo.DisplayName}" Width="100" DisplayName="Header_Assigned_To" Property="ActivityAssignedTo.DisplayName" DataType="s:String" />

              <mux:Column Name="statusDisplayName" DisplayMemberBinding="{Binding Path=Status.DisplayName}" Width="100" DisplayName="Header_Status" Property="Status.Ordinal" DataType="s:Double" />

              <mux:Column Name="stageDisplayName" DisplayMemberBinding="{Binding Path=Stage.DisplayName}" Width="100" DisplayName="Header_Stage" Property="Stage.Ordinal" DataType="s:Double" />

            </mux:ColumnCollection>

          </Columns>

          <ViewStrings>

            <ViewString ID="Header_Id">$MPElement[Name="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Id"]$</ViewString>

            <ViewString ID="Header_Title">$MPElement[Name="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Title"]$</ViewString>

            <ViewString ID="Header_Parent_DisplayName">$MPElement[Name="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Parent_DisplayName"]$</ViewString>

            <ViewString ID="Header_Parent_Status">$MPElement[Name="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Parent_Status"]$</ViewString>

            <ViewString ID="Header_Assigned_To">$MPElement[Name="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Assigned_To"]$</ViewString>

            <ViewString ID="Header_Status">$MPElement[Name="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Status"]$</ViewString>

            <ViewString ID="Header_Stage">$MPElement[Name="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Stage"]$</ViewString>

          </ViewStrings>

        </Presentation>

      </View>

    </Views>

    <FolderItems>

      <FolderItem ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest" ID="ActivityManagement.FolderItems.AllActivitiesinChangeRequest" Folder="Activity!ServiceManager.Console.ActivityManagement" />

    </FolderItems>

    <ImageReferences>

      <ImageReference ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest" ImageID="Activity!ActivityImage16x16" />

    </ImageReferences>

    <StringResources>

      <StringResource ID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Id" />

      <StringResource ID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Stage" />

      <StringResource ID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Status" />

      <StringResource ID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Title" />

      <StringResource ID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Assigned_To" />

      <StringResource ID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Parent_DisplayName" />

      <StringResource ID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Parent_Status" />

    </StringResources>

  </Presentation>

  <LanguagePacks>

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

      <DisplayStrings>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest">

          <Name>All Activities in Change Request</Name>

          <Description>All Activities in Change Request</Description>

        </DisplayString>

        <DisplayString ElementID="System.WorkItem.ActivityChangeRequestViewProjection">

          <Name>Activity (typical)</Name>

          <Description>Defines the properties of activities typically used in views</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views">

          <Name>Activity Management Views Library</Name>

          <Description>Activity Management Views Library</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Id">

          <Name>ID</Name>

          <Description>ID</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Stage">

          <Name>Stage</Name>

          <Description>Stage</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Status">

          <Name>Status</Name>

          <Description>Status</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Title">

          <Name>Title</Name>

          <Description>Title</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Assigned_To">

          <Name>Assigned To</Name>

          <Description>Assigned To</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Parent_DisplayName">

          <Name>Change Request</Name>

          <Description>Change Request</Description>

        </DisplayString>

        <DisplayString ElementID="ActivityManagement.Views.AllActivitiesinChangeRequest.Header_Parent_Status">

          <Name>Change Request Status</Name>

          <Description>Change Request Status</Description>

        </DisplayString>

      </DisplayStrings>

    </LanguagePack>

  </LanguagePacks>

</ManagementPack>

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

This section provides details of the different components in the management pack above. You should skip this section is you are only interested in the “how to get it to work”. You can find more details on management pack mechanics here.

1.        Manifest Section

The references section identifies the Management Pack and lists the dependencies for this management pack. Aliases defined for these references make it easier to refer to these management packs in the subsequent sections

2.        Type Definitions

 

For this view we need to show some properties of the Activity and some properties of the parent Change Request and the User the activity is assigned to. So we have to create a Type Projection for an Activity type that contains the parent change request and the assigned to user. You can find more details about Type Projections here.

 

3.        Categories section

This enables the view to be edited or deleted from the UI.

Note: This view should not be edited from the UI as it contains columns that are not supported by the UI and upon editing these columns will be removed.

4.        Presentation

This section contains data that will be used by the Service Manager console UI.

 

The view definition specifies the

Type: The projection we created System.WorkItem.ActivityChangeRequestViewProjection.

Criteria: All Activities where the parent Change Request status is not Closed

View Columns: Id, Title, Parent Change Request, Parent Change Request Status, Assigned To User, Status, Stage

 

It also contains a reference to the icon for the view and a reference to the folder that should contain the view.

5.        Language Pack section:

This enables display of user friendly names in the UI.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • <p>Hi Amit,</p> <p>Can you help us to create a similar view in incident to view all incidents that are a part of a Problem and see the Problem information in the view columns?</p> <p>Thanks</p> <p>Celine</p>

  • <p>Amit - Not sure if you review this or will get this but could you please review the issue I am having with this view please? </p> <p><a rel="nofollow" target="_new" href="http://social.technet.microsoft.com/Forums/en-US/customization/thread/1dfe17c1-b2f3-417f-974e-8f6a0eb9a7a0/">social.technet.microsoft.com/.../1dfe17c1-b2f3-417f-974e-8f6a0eb9a7a0</a></p> <p>Rob Ford is looking at it but whenever I add any criteria it bombs out with the full adapter error. &nbsp;Using SCSM 2012 RU3. Any suggestion would be appreciated.</p>

  • This is great and has helped my Department heaps<br/><br/>Thank you