Hi Aries,
yes, it's technically possible to subscribe any property field as long as a relationship exists between the source (the class/projection you specify at the very start when you create the template and subscription). It's just not as easy to do, because you
have to make up the relationship path on your own since the "Insert" functionality provided by the GUI is limited in that area.
See my comment on page 2 on the blog post mentioned by MSSQL-DB above to understand what needs to be done in the MP XML. You already figured out how to subscribe the CR ID when using single level activities. I'll try to explain now how to make up the relationship
path when using 2nd level or multi level activities:
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='WorkItem!System.WorkItem']/Property[Type='WorkItem!System.WorkItem']/Id$
This path will work only for single level activities. This is basically because you're telling the workflow engine to look up a the related object by specifying the relationship class. And then when you got the object, you're telling the engine to use the
ID field of that related object.
it just know its direct parent object which is the Parallel / Sequentiell Activity. The parent object of the Parallel / Sequentiell Activity now is the CR. This means the manual activity is related to the CR thanks to nested relationships. You just need
to make up this nested relationship as the path to actually subscribe them. Visualized the relationship path would look something like this:
Manual Activity -> [Contains Activity Relationship] -> Parallel / Sequential Activity -> [Contains Activity Relationship] -> Change Request
Now long story short, this would be the relationship path you have to paste in the notification template for this use case:
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='WorkItem!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='WorkItem!System.WorkItem']/Property[Type='WorkItem!System.WorkItem']/Id$
I basically just added another relationship layer in this path. The relationship you use in your path of course must exist between the source and the target class, otherwise the path won't work. I recommend to use PowerShell cmdlets to see what's a
valid relationship class. See also my other posts in this thread to learn a bit better this technique and how it can be used:
http://social.technet.microsoft.com/Forums/en-US/dc498dbe-5e02-4b23-8f2b-6dc32782a25c/notification-on-service-request-instead-of-activity?forum=administration
One last advice: Of course you don't want to create notification templates for each and every Activity combination. And luckily you don't have to :) Just add the relationship path combinations you're using in your environment one by one
after another (without spaces). If the path is not resolvable, SCSM will just display a blank output. So this relationship path combination will work regardless if the Manual Activity is a single level or second level activity:
$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='WorkItem!System.WorkItem']/Property[Type='WorkItem!System.WorkItem']/Id$$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='WorkItem!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='WorkItem!System.WorkItem']/Property[Type='WorkItem!System.WorkItem']/Id$
Just go ahead and interpolate with as many level you may use.
Hope this helps and clarifies how to get this done.
Maybe a moderator can pin this thread as I got the impression that these question are popping up quite frequently?!
Happy new year!
BR
Alex
-
Proposed as answer by
Andreas BaumgartenMVP, Moderator
Tuesday, December 31, 2013 12:10 PM
-
Marked as answer by
Andreas BaumgartenMVP, Moderator
Tuesday, December 31, 2013 12:10 PM