Notification template
I need create template for Review Activity class, in body of notification I need paste field from parent Service request example Title, ID, Description and my custom field.
This strings are not work:
$Context/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemHasParentWorkItem' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$
$Context/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemHasParentWorkItem' TypeConstraint='CustomInfopulse_Sd_BusinessTripServiceRequestClass!Infopulse.Sd.BusinessTripServiceRequest']/Property[Type='CustomInfopulse_Sd_BusinessTripServiceRequestClass!Infopulse.Sd.BusinessTripServiceRequest']/new_Allowance$
Who can help me How write Parent SR Property for Review Activity?
Best Answer
-
Jamie_Jordan Customer IT Monkey ✭
I haven't tried it, but I think you can replace "WorkItemAffectedUser" with "WorkItemAssignedToUser" in the strings above
5
Answers
I had to do a similar thing recently and found this worked.
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_ServiceRequest_Library!System.WorkItem.ServiceRequest']/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$
The key to making it work was adding "SeedRole='Target'" into the substitution string after it was generated.
If you're using a review activity that is nested inside another type of activity and need to get the SR information you'll need to go up one more level to get it. This is what worked for me to get the SR Id into the notification
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$
How I can get internal(long) ID of parent SR?
How I can get affected user from parent SR for RA notification
$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$?
it is not work
@Roman_Nepomniashchii, I use this to get the first name of the affected user from the 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.User']/Property[Type='CustomSystem_Library!System.User']/FirstName$
And this to get the last 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.User']/Property[Type='CustomSystem_Library!System.User']/LastName$
Replacing with display name might work, but in our environment the display name is backwards, so I had to get them separately.
maybe you know how I can get assigned user? affected I get successful thank you!
I haven't tried it, but I think you can replace "WorkItemAffectedUser" with "WorkItemAssignedToUser" in the strings above
I have problem with notification template
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='CustomInfopulse_Sd_BusinessTripRequest_Class!Infopulse.Sd.BusinessTripRequest']$?$Id$? - it's not work. I need get info from SR(my custom class which inheritant from SR) which have relationship with MA, my template for class MA.
Management Pack with custom class
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>Infopulse.Sd.BusinessTripRequest.Class</ID>
<Version>1.0.0.3</Version>
</Identity>
<Name>Infopulse.Sd.BusinessTripRequest.Class</Name>
<References>
<Reference Alias="System">
<ID>System.Library</ID>
<Version>7.5.8501.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="Console">
<ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
<Version>7.5.7487.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="Alias_ee4c7633_f04f_4c2d_b150_db0537673a54">
<ID>System.WorkItem.ServiceRequest.Library</ID>
<Version>7.5.7487.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
</References>
</Manifest>
<TypeDefinitions>
<EntityTypes>
<ClassTypes>
<ClassType ID="Infopulse.Sd.BusinessTripRequest" Accessibility="Public" Abstract="false" Base="Alias_ee4c7633_f04f_4c2d_b150_db0537673a54!System.WorkItem.ServiceRequest" Hosted="false" Singleton="false" Extension="false">