Compartilhar via


Include Details from Parent Work Items in Notifications

UPDATE ON 6/9/2015 – How do I traverse one more relationship if say I want to add Assigned to user of a CR or Affected User of a Parent SR to a notification based on / triggered off child activity going into in progress – See bottom of post – Search for UPDATE ON 6/9/2015)

HEALTH WARNING: Be very careful cutting and pasting anything with quotes from here, other blog posts, word docs or emails as you may end up with an invalid quote in your notification template, preventing an email from being sent out at all.

There are some blogs out there on this (Thanks Travis Smile), but I struggled to find anything relating specifically to parent SRs which is one of the most common elements I find my customers want to include details from, when triggering a notification of a child activity going to in progress.  And some of my customers have some cool customized SRs for purchase requests / new hire / employee termination process etc. and they want to include those custom properties from the parent SR (that were populated via prompts on the portal) in their activity notifications, and I found nothing on how to do that.

For example, lets say you have a new hire SR as described in my other post and then as part of the approval process, you want a notification to go out to the new employee’s manager, and include some specific properties from your custom SR class, to aid the hiring manager in approving the activity before Orchestrator goes off and does its various magic to create the user with the specified properties.

Before we continue, an alternative way to achieve this is to use orchestrator to put those entered values into a commonly available field (like title or description) and then in your SCSM notification template, just add Title or description.   I’ve seen some customers use approaches like this to parse the user inputs (entered via request offering prompts in the portal) into the title or description.

However the focus of this blog is to explain how you can insert the values directly into a notification template.

We will focus on SR for now and getting the data from a parent SR into a child manual / review activity notification.

NOTE: Remember the notification template will be based off Manual Activity or Review Activity, because the subscription we will later create will trigger off a manual / review status changing from does not equals ‘In Progress’ changing to equals ‘In Progress’.

First things first is figuring out the relationship you need to use. This is best determined from the history tab of the child activity.

So for example if I look at a child manual activity within an SR, we can see the name of the relationship that associates the activity we’re looking at, to the parent SR is called ‘Contains Activity’

image

This helps us when we come to create the notification template in terms of picking the relationship as it narrows it down to two possibilities (not needed that second one to date so not sure what it is for Smile ) :

image

NOTE: Keep reading on after the next paragraph as there’s a second step required to get this working Smile 

Once we pick the top ‘contains activity’ (it HAS to be the top one!!) then we can pick any of the values in the Work Item section on the right hand side which are values that are stored in the activity’s parent SR, so for instance description highlighted below is the SR description of the parent SR that contains the child manual activity.

image

If you pick the ID on the right rather than the description, you’ll end up with something like this shown in the notification template (WHICH DOES NOT WORK, SO PLEASE READ ON AFTER Smile ).

CONTAINS ACTIVITY
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$

If you leave it like that, guess how it comes out in the email.  It’s the big gaping space you see here under the second section where it says CONTAINS ACTIVITY:

image

The end result we want is the one shown below that which does show the Parent SR ID:

image

So how do we do that?  The secret is in a seedrole.  All you need to do is add this before the words TypeConstraint:

SeedRole='Target'

such that the old one which is this:

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$

becomes this:

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$

This is how it looks in the template:

image

And then once you have that you can substitute ID for any of the values you see available under work item.

2nd HEALTH WARNING: The internal name (which is what you need to put in the template) may not be what you expect based on the display name.  See below:

WORK ITEM:

Display Name Internal Name
Actual Cost ActualCost
Actual Downtime End Date ActualDowntimeEndDate
Actual Downtime Start Date ActualDowntimeStartDate
Actual End Date ActualEndDate
Actual Start Date ActualStartDate
Actual Work Hours ActualWork
Alternate contact method ContactMethod
Created Date CreatedDate
Description Description
First Assigned Date FirstAssignedDate
First response date FirstResponseDate
ID Id
Is Downtime IsDowntime
Is parent IsParent
Planned Cost PlannedCost
Planned Work Hours PlannedWork
Required By RequiredBy
Scheduled Downtime End Date ScheduledDowntimeEndDate
Scheduled Downtime Start Date ScheduledDowntimeStartDate
Scheduled end date ScheduledEndDate
Scheduled Start date ScheduledStartDate
Title Title
User Input UserInput

OK, great so far that we can add all these.

Now,  what if I need something SR specific like area, Urgency, Priority, Support Group, Source, Implementation results, Implementation notes etc.  Here’s that full list of possibilities:

image

Now we give ourselves a little more work to do Smile 

What we need to add is the Service Request class Internal name, the property internal name (not necessarily what you see in the table directly above), and the MP Alias referencing the MP  containing the class definition.   Here’s one way you can figure that out…

Create a notification template based on the class you’re trying to get properties for (like Service request) and then add one of the class specific properties using the insert button.  You should end up with something like this:

image

This gives me the 3 pieces of information that I need – the MP alias, the class name, and the property name:

$Context/Property[Type='CustomSystem_WorkItem_ServiceRequest_Library!System.WorkItem.ServiceRequest']/Area$

NOTE: Anything preceding a ‘!’ is an MP alias that should be found in the references section at the top of the MP where the alias is used.

So now going back to our manual activity notification template, we will start with the string we used to successfully get the Parent SR ID:

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$

What we need to do is substitute the MP Alias, the class name and the property name.

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint=’MPAlias!ClassInternalName']/Property[Type=’MPAlias!ClassInternalName]/PropertyInternalName$

so the result is:

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_ServiceRequest_Library!System.WorkItem.ServiceRequest’]/Property[Type='CustomSystem_WorkItem_ServiceRequest_Library!System.WorkItem.ServiceRequest']/Area$

NOTE ON REFERENCES: You will also need to ensure the MP alias is included in the ‘references’ section of the MP that you’re creating the notification template in.  One easy way to do this is create a template based on the class in the same MP that you’re crating your manual activity notification templates (even just temporarily and delete the template when you’re done as the reference will persist).   In my case because I’m using the CustomSystem_workItem_serviceRequest_Library! MP Alias, I need to ensure the corresponding reference is in my MP where I’m storing my notification templates:

image

<Reference Alias="CustomSystem_WorkItem_ServiceRequest_Library">
       <ID>System.WorkItem.ServiceRequest.Library</ID>
       <Version>7.5.2905.0</Version>
       <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
     </Reference>

Now you can use the same string, but substitute the property internal name for other ones.  Here’s that handy-dandy list of display names and ID names so you can substitute as needed:

SERVICE REQUEST

DISPLAY NAME INTERNAL NAME
Area Area
Closed Date ClosedDate
Completed Date CompletedDate
Implementation Results ImplementationResults
Notes Notes
Priority Priority
Source Source
Status Status
Support Group SupportGroup
Template ID TemplateId
Urgency Urgency

So that’s everything you need right?  Well there’s one more part of the puzzle.  What if we extend our class and want to include extended properties from the parent SR in our manual activity notification.  Well the good news there is that it’s exactly the same as what we just did to get the SR-specific properties in, but instead we use the internal name for the extended version of our SR when we extended it in the authoring tool, together with an MP alias referencing the MP that we performed this extension in.

So for example…

Here is how an extended SR looks in the authoring tool with that all important internal name shown (please click on the image to see it better):

image

So in that case, our class internal name is ClassExtension_65552f71_c29d_4438_827c_9db6015c10b0

The MP this is stored in is the CustomProps MP.   Now we know this, we can create a template based on our extended class (in this case it will just be the OOB Service Request class), populate one of our custom properties with a value in the template, and then when I export the MP to XML (from Administration>Management Packs) I’ll get my reference:

<Reference Alias="CustomProps">
        <ID>CustomProps</ID>
        <Version>1.0.0.4</Version>
        <PublicKeyToken>b7e405a08a89a054</PublicKeyToken>
      </Reference>

Now if I don’t want that template any more, I can just go ahead and delete the template, and my reference will persist.

So now we have our MP Alias and our Class Internal Name.

MP Alias – CustomProps

Class Internal Name -  ClassExtension_65552f71_c29d_4438_827c_9db6015c10b0

The one last thing we need is out internal property Name which you can either find in the xml where your class is defined, or the authoring tool similarly to how we got the class name,

So in my case the end result is like this:

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomProps!ClassExtension_65552f71_c29d_4438_827c_9db6015c10b0']/Property[Type='CustomProps!ClassExtension_65552f71_c29d_4438_827c_9db6015c10b0']/ExtendedString1$

Using this approach you can include items from a parent SR (whether it be the OOB one, an extended one or an inherited one)

For completeness, I have included tables below for Incident and Change request Work Items (together with the SR and work item ones we saw earlier) as you might like to include these values in manual / review activity subscriptions where one of those is a parent item.

CHANGE REQUESTS:

DISPLAY NAME INTERNAL NAME
Area Area
Back out Plan BackoutPlan
Category Category
Impact Impact
Implementation Plan ImplementationPlan
Implementation Results ImplementationResults
Notes Notes
Post Implementation review PostImplementationReview
Priority Priority
Reason Reason
Required By Date RequiredByDate
Risk Risk
Risk Assessment Plan RiskAssessmentPlan
Status Status
Template ID TemplateId
Test Plan TestPlan

INCIDENTS:

DISPLAY NAME INTERNAL NAME
Classification Category Classification
Escalated Escalated
Has created knowledge article HasCreatedKnowledgeArticle
Last modified source LastModifiedSource
Needs knowledge article NeedsKnowledgeArticle
Resolution category ResolutionCategory
Resolution description ResolutionDescription
Resolve by TargetResolutionTime
Source Source
Status Status
Support group TierQueue

(and repeated from above):

SERVICE REQUEST

DISPLAY NAME INTERNAL NAME
Area Area
Closed Date ClosedDate
Completed Date CompletedDate
Implementation Results ImplementationResults
Notes Notes
Priority Priority
Source Source
Status Status
Support Group SupportGroup
Template ID TemplateId
Urgency Urgency

WORK ITEM:

Display Name Internal Name
Actual Cost ActualCost
Actual Downtime End Date ActualDowntimeEndDate
Actual Downtime Start Date ActualDowntimeStartDate
Actual End Date ActualEndDate
Actual Start Date ActualStartDate
Actual Work Hours ActualWork
Alternate contact method ContactMethod
Created Date CreatedDate
Description Description
First Assigned Date FirstAssignedDate
First response date FirstResponseDate
ID Id
Is Downtime IsDowntime
Is parent IsParent
Planned Cost PlannedCost
Planned Work Hours PlannedWork
Required By RequiredBy
Scheduled Downtime End Date ScheduledDowntimeEndDate
Scheduled Downtime Start Date ScheduledDowntimeStartDate
Scheduled end date ScheduledEndDate
Scheduled Start date ScheduledStartDate
Title Title
User Input UserInput

UPDATE ON 6/9/2015 – How do I traverse one more relationship if say I want to add Assigned to user of a CR or Affected User of a Parent SR to a notification based on / triggered off child activity going into in progress?

The examples below show the syntax that you would add to a notification template based off the manual activity or review activity class, to get a related item from the parent work item (eg parent CR assigned user / parent SR affected user / parent CR / SR related config item etc).  Please also ensure if you’re cut and pasting from the below that you have the associated reference with the same alias (as described in the ‘NOTE ON REFERENCES’ section above that I included in the original post.

Config Items to Change comes from here (General Tab of CR):

clip_image001

Config Items to Change Syntax for display name:

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Assigned to (General Tab of CR):

clip_image002

Assigned To User Syntax for Display Name

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAssignedToUser' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

If you want other properties such as first name etc, you would use slightly different syntax (based on the User System.User class rather than the generic ‘Configuration Item’ System.ConfigItem Class as shown here:

Assigned To User

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAssignedToUser' TypeConstraint='CustomSystem_Library!System.User']/Property[Type='CustomSystem_Library!System.User']/FirstName$

Affected User of an SR
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAffectedUser' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

If you want other properties such as first name etc, you would use slightly different syntax (based on the User System.User class rather than the generic ‘Configuration Item’ System.ConfigItem Class as shown here:

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAffectedUser' TypeConstraint='CustomSystem_Library!System.User']/Property[Type='CustomSystem_Library!System.User']/FirstName$

Configuration Items: Computers Services and People (Related Items tab of CR)

clip_image003

Configuration Items: Computers, Services and People Syntax for Display Name

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemRelatesToConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

BLOG POST APPENDIX / REFERENCE

This section includes some additional information and examples about relationships and how to use them in notification templates

RELATIONSHIPS

Each of the relationship extracts below were returned from PowerShell using a command like this (change ‘config’ to something else contained in the display name of the relationship to look for the one you’re after:
Get-SCRelationship | where-object {$_.displayname -like '*config*'} | format-list *

The other thing you may need as you’ve probably found if you’ve got this far in this blogpost Smile is the MP that the relationship is stored in and the default way in which we reference that MP.  I found the MP using this query and substituting the contents of the like criteria with part of the Id property shown in the the relationship listings below:

select * from relationshiptype reltype
inner join managementpack mp on reltype.ManagementPackId = mp.ManagementPackId
where RelationshipTypeId like '%448664f-%'

or to just get the MP name:

select mpname, MPFriendlyName from relationshiptype reltype
inner join managementpack mp on reltype.ManagementPackId = mp.ManagementPackId
where RelationshipTypeId like '%448664f-%'

So here are the details and examples of how to use the relationships in notification templates, and where you can find examples of these relationships being used in the Service Manager Console:

About Configuration Item

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : IsAboutConfigItems
Target             : HasRelatedWorkItems
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.WorkItem.Library/31bf3856ad364e35|1.0.0.0|System.WorkItemAboutConfigItem||
Name               : System.WorkItemAboutConfigItem
Id                 : b73a6094-c64c-b0ff-9706-1822df5c2e82
DisplayName        : About Configuration Item
Description        : Relationship between a work item, such as an incident or a change request, and the configuration item it affects
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:24:38 PM
TimeAdded          : 7/23/2012 10:23:27 AM
InstanceName       :

MP Friendly Name:   System Work Item Library
MPName:    System.WorkItem.Library
Default Reference / Alias if reference used n console -   CustomSystem_WorkItem_Library

<Reference Alias="CustomSystem_WorkItem_Library">
        <ID>System.WorkItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Where to find in Service Manager Console:

Config Items to Change (CR General tab):

Affected Configuration Items (SR General tab):

image

======================================

Is Related to Configuration Item

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : RelatesToWorkItem
Target             : RelatesToConfigItem
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.WorkItem.Library/31bf3856ad364e35|1.0.0.0|System.WorkItemRelatesToConfigItem||
Name               : System.WorkItemRelatesToConfigItem
Id                 : d96c8b59-8554-6e77-0aa7-f51448868b43
DisplayName        : Is Related to Configuration Item
Description        : Relationship between a work item, such as an incident or a change request, and a configuration item
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:24:38 PM
TimeAdded          : 7/23/2012 10:23:27 AM
InstanceName       :

MP Friendly Name:   System Work Item Library
MPName:    System.WorkItem.Library
Default Reference / Alias if reference used n console -   CustomSystem_WorkItem_Library

<Reference Alias="CustomSystem_WorkItem_Library">
        <ID>System.WorkItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemRelatesToConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Where to find in Service Manager Console:

Configuration Items: Computers, Service and People (CR Related Items Tab):

===============================================

Contains Configuration Item (for business services with dependent / contained objects)

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=189f4500-7a70-db53-9566-feea4695da29
Source             : ConfigItem
Target             : ContainedConfigItem
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.Library/31bf3856ad364e35|1.0.0.0|System.ConfigItemContainsConfigItem||
Name               : System.ConfigItemContainsConfigItem
Id                 : 91ff6f8e-226f-68b6-d132-d1d2df453693
DisplayName        : Contains Configuration Item
Description        : Relationship between a configuration item and configuration items that it contains
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:22:53 PM
TimeAdded          : 7/23/2012 10:23:01 AM
InstanceName       :

MP Friendly Name:  System Library
MPName:   System.Library
Default Reference / Alias if reference used n console - 

      <Reference Alias="CustomSystem_Library">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version> (Service impacts USer)
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Defualt Reference / Alias if reference used n console -   CustomSystem_Library

Example of use in Notification Template (In an Activity inside a CR / SR):

Customer Affected by Service
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']/Path[Relationship='CustomSystem_Library!System.ConfigItemContainsConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Where to find in Service Manager Console:

Service Dependents (Business Service ‘Service Dependents’ Tab):

image

===============================================

Is Related to Configuration Item

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : SourceConfigItem
Target             : TargetConfigItem
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.Library/31bf3856ad364e35|1.0.0.0|System.ConfigItemRelatesToConfigItem||
Name               : System.ConfigItemRelatesToConfigItem
Id                 : 4448664f-b657-407a-cdbe-b7433af0ccdb
DisplayName        : Is Related to Configuration Item
Description        : Relationship between a configuration item and related configuration items
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:22:53 PM
TimeAdded          : 7/23/2012 10:23:01 AM
InstanceName       :

 

MP Frendly Name:  System Library
MPName:   System.Library
Defualt Reference / Alias if reference used n console - 
Example of us in NT Template: 

      <Reference Alias="CustomSystem_Library">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']/Path[Relationship='CustomSystem_Library!System.ConfigItemRelatesToConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Where to find in Service Manager Console:

Configuration Items: Computers, Services and People (CI Related Items Tab)

image

===============================================

Affected User

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : IsCreatedForUser
Target             : RequestedWorkItem
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.WorkItem.Library/31bf3856ad364e35|1.0.0.0|System.WorkItemAffectedUser||
Name               : System.WorkItemAffectedUser
Id                 : dff9be66-38b0-b6d6-6144-a412a3ebd4ce
DisplayName        : Affected User
Description        : Affected User
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:24:38 PM
TimeAdded          : 7/23/2012 10:23:27 AM
InstanceName       :

MP Friendly Name:   System Work Item Library
MPName:    System.WorkItem.Library
Default Reference / Alias if reference used n console -   CustomSystem_WorkItem_Library

<Reference Alias="CustomSystem_WorkItem_Library">
        <ID>System.WorkItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):

Assigned To User Syntax for Display Name
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAffectedUser' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAffectedUser' TypeConstraint='CustomSystem_Library!System.User']/Property[Type='CustomSystem_Library!System.User']/FirstName$

Where to find in Service Manager Console:

Affected User (SR / IR General Tab)

image

image

=============================================

Affects Service

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : ImpactingWorkItem
Target             : ImpactedService
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.WorkItem.Library/31bf3856ad364e35|1.0.0.0|System.WorkItemImpactsService||
Name               : System.WorkItemImpactsService
Id                 : d421cda9-b728-9b41-c27c-7677b9a40d37
DisplayName        : Affects Service
Description        : Relationship between a work item, such as an incident or a change request, and the services that the work item affects
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:24:38 PM
TimeAdded          : 7/23/2012 10:23:27 AM
InstanceName       :

Affected Services (Incident General Form)
MP Frendly Name:   System Work Item Library
MPName:    System.WorkItem.Library
Defualt Reference / Alias if reference used n console -   CustomSystem_WorkItem_Library

<Reference Alias="CustomSystem_WorkItem_Library">
        <ID>System.WorkItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (based on an Incident)

$Context/Path[Relationship='WorkItem!System.WorkItemImpactsService' TypeConstraint='System!System.Service']$?$DisplayName$?

Where to find in Service Manager Console:

Affected Services (IR General Tab):

image

Showing Affected Users of Business Service CI as shown here:

image

===============================================
Affects Customers

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : ConfigItem
Target             : BusinessCustomers
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.Library/31bf3856ad364e35|1.0.0.0|System.ConfigItemImpactsCustomers||
Name               : System.ConfigItemImpactsCustomers
Id                 : 3c00f0fa-66e5-642a-e24d-93fecc6b4f6d
DisplayName        : Affects Customers
Description        : Relationship between a configuration item and the customers that it affects
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:22:53 PM
TimeAdded          : 7/23/2012 10:23:01 AM
InstanceName       :

MP Friendly Name:  System Library
MPName:   System.Library
Default Reference / Alias if reference used n console - 

      <Reference Alias="CustomSystem_Library">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version> (Service impacts USer)
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):

Customer Affected by Service
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']/Path[Relationship='CustomSystem_Library!System.ConfigItemImpactsCustomers' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Where to find in Service Manager Console:

Affected Services (IR General Tab):

image

Showing Service Customers of Business Service CI as shown here:

image
================================
Affects User

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : Service
Target             : ImpactedUser
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.Library/31bf3856ad364e35|1.0.0.0|System.ServiceImpactsUser||
Name               : System.ServiceImpactsUser
Id                 : fbd04ee6-9de3-cc91-b9c5-1807e303b1cc
DisplayName        : Affects User
Description        : Relationship between a service and the users that it affects
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:22:53 PM
TimeAdded          : 7/23/2012 10:23:01 AM
InstanceName       :

MP Friendly Name:  System Library
MPName:   System.Library
Default Reference / Alias if reference used n console - 

      <Reference Alias="CustomSystem_Library">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version> (Service impacts USer)
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):

Customer Affected by Service
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']/Path[Relationship='CustomSystem_Library!System.ServiceImpactsUser' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Where to find in Service Manager Console:

Affected Services (IR General Tab):

image

Showing Affected Users of Business Service CI as shown here:

image

=======================
Assigned To User

PS C:\pshellForSCSm> Get-SCRelationship | where-object {$_.displayname -like '*assign*'} | format-list *

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : IsAssignedToUser
Target             : AssignedWorkItem
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.WorkItem.Library/31bf3856ad364e35|1.0.0.0|System.WorkItemAssignedToUser||
Name               : System.WorkItemAssignedToUser
Id                 : 15e577a3-6bf9-6713-4eac-ba5a5b7c4722
DisplayName        : Assigned To User
Description        : The user the work item is assigned to
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:24:38 PM
TimeAdded          : 7/23/2012 10:23:27 AM
InstanceName       :

MP Friendly Name:   System Work Item Library
MPName:    System.WorkItem.Library
Default Reference / Alias if reference used n console -   CustomSystem_WorkItem_Library

<Reference Alias="CustomSystem_WorkItem_Library">
        <ID>System.WorkItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):

Assigned To User Syntax for Display Name
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAssignedToUser' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAssignedToUser' TypeConstraint='CustomSystem_Library!System.User']/Property[Type='CustomSystem_Library!System.User']/FirstName$

Where to find in Service Manager Console:

Assigned To User (SR / IR / CR General Tab) / Activity Implementer (MA General Tab)

image

image

 

image

 

image

===================================

Owned By User

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : ConfigItem
Target             : OwnedBy
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.Library/31bf3856ad364e35|1.0.0.0|System.ConfigItemOwnedByUser||
Name               : System.ConfigItemOwnedByUser
Id                 : cbb45424-b0a2-72f0-d535-541941cdf8e1
DisplayName        : Owned By User
Description        : Relationship between a configuration item, such as a computer, and the user that owns it
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:22:53 PM
TimeAdded          : 7/23/2012 10:23:01 AM

MP Friendly Name:  System Library
MPName:   System.Library
Default Reference / Alias if reference used n console - 
Example of us in NT Template: 

      <Reference Alias="CustomSystem_Library">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>

Example of use in Notification Template (In an Activity inside a CR / SR):

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem' TypeConstraint='CustomSystem_Library!System.ConfigItem']/Path[Relationship='CustomSystem_Library!System.ConfigItemOwnedByUser' TypeConstraint='CustomSystem_Library!System.ConfigItem']$?$DisplayName$?

Where to find in Service Manager Console:

Custodian (CI General Tab)

image

===========================================

Primary Owner (of an incident)

PropertyCollection : {}
Base               : ManagementPackElementUniqueIdentifier=5996b276-2d7f-7ca5-68e7-09186d9462d5
Source             : PrimaryOwner
Target             : RelatesToIncident
XmlTag             : RelationshipType
Abstract           : False
Accessibility      : Public
ManagementGroup    : GPS-SM-MG
ManagementGroupId  : 9dde6ad9-9e32-73b3-15ce-57c60e66d54d
Identifier         : 1|System.WorkItem.Incident.Library/31bf3856ad364e35|1.0.0.0|System.WorkItem.IncidentPrimaryOwner||
Name               : System.WorkItem.IncidentPrimaryOwner
Id                 : 42179172-3d24-cfc8-3944-b0a18f550214
DisplayName        : Primary Owner
Description        : Primary Owner
LanguageCode       : ENU
Comment            :
Status             : Unchanged
LastModified       : 4/7/2013 8:30:35 PM
TimeAdded          : 7/23/2012 10:31:33 AM
InstanceName       :

System.WorkItem.Incident.Library

MP Frendly Name: System Work Item Incident Library
MPName:  System.WorkItem.Incident.Library
Defualt Reference / Alias if reference used n console -  CustomSystem_WorkItem_Incident_Library

Example of use in Notification Template (In an Activity inside a IR):

$Context/Path[Relationship='CustomSystem_WorkItem_Incident_Library!System.WorkItem.IncidentPrimaryOwner' TypeConstraint='CustomSystem_Library!System.User']$?$DisplayName$?

Where to find in Service Manager Console:

Primary Owner (SR / IR General Tab)

image

=====================================

 

Happy Subscribing!  Cheers, Antoni

Comments

  • Anonymous
    January 01, 2003
    Hi Anthony. To date I have only done this with orchestrator to do this extra hop. If I can figure out how to do it in a similar way to how I did it here, I will post an update. Cheers,Antoni
  • Anonymous
    September 01, 2014
    Another brilliant and well written up,what I have been looking for all along..........its a shame such small things are not built into the product. We as SCSM admins feel MS is not putting enough into the product compared to the other System Center products. Thank you very much.
  • Anonymous
    September 04, 2014
    Great post Antoni!

    Hey Sam, we hear you! The product team is focused on fixing the in-market issues around usability, perf, and scale with the product right now. These are areas which are crucial to the overall health of the product, and no matter way which way we cut it, a scalable, performant and robust platform comes first. I think it's fantastic that we have the luxury of staying focused on the core of the product and rely on the community to come up with nifty solutions to fill in the application layer gaps.
  • Anonymous
    September 11, 2014
    If an MA is contained under a Parallel activity the code to display the PWI ID is actually displaying the PA's ID. Is there a work around for this?
  • Anonymous
    January 27, 2015
    Hi Antoni! Great post!
    I got this working but not with my inherited service request...References should be fine but when testing template it only gives me the code.
    How can I find the the correct Relationship for inherited class? In your example being the 'CustomSystem_WorkItem_ServiceRequest_Library!System.WorkItem.ServiceRequest'

    Thanks!

  • Anonymous
    March 18, 2015
    This is great post, but I was wondering, how can I add the Affected User to the email template? Thanks for your efforts.
  • Anonymous
    June 09, 2015
    Hi Tommi and Pat, hopefully better late than never I have added to this which will hopefully answer your questions. Cheers, Antoni
  • Anonymous
    June 15, 2015
    Hi Antoni,

    Thank you for the amazing post. Is it possible to include the following details from a Release Record:

    Category
    Risk
    Impact

    Thanks for any assistance.
  • Anonymous
    June 15, 2015
    Hi Arun,

    Yes, Start here in the blog for details on how to get properties for other classes:

    "Now, what if I need something SR specific like area, Urgency, Priority, Support Group, Source, Implementation results, Implementation notes etc. Here’s that full list of possibilities:"

    It will look a little something like this
    $Context/Property[Type='CustomSystem_WorkItem_ReleaseRecord_Library!System.WorkItem.ReleaseRecord']/Risk$

    Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_ReleaseRecord_Library!System.WorkItem.ReleaseRecord']/Property[Type='CustomSystem_WorkItem_ReleaseRecord_Library!System.WorkItem.ReleaseRecord']/Risk$

    and be sure to ensure your MP reference ('CustomSystem_WorkItem_ReleaseRecord_Library!) is included at the top of the MP. Cheers,
    Antoni

  • Anonymous
    July 30, 2015
    Hi Antoni,

    Great post!

    Is it possible to trigger a notification on a review activity that goes into the "in progress" state and send all reviewers on the activity a personalized email starting with something like "Dear %FirstNameOfReviewer%". What we do now is send the email without any personal information, but all other notification templates are personalized so it would be nice to also have this in the email directed to the reviewers.

    Thanks!