Notification on Service Request instead of Activity

  Further to Past Thread on Child activity only able to access Parent Work Item only to a single level i-e SeedRole='target' cannot be used twice.

  However it is noteworthy that Parent Item can access child items up to two levels. I-e from Service Request -> Child Activity -> About CI ->Display Name  (you can note /Path[RelationShip used twice)

 So it seems that if notifications can be configured on Service Requests instead of Activities can work in some cases where the criteria for email can be defined at that level.

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity   'TypeConstraint='CustomSystem_WorkItem_Library!System.WorkItem']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAboutConfigItem'TypeConstraint='CustomProvance_ServiceManager_Itam_Core_Library!Provance.ITAM.Location']/Property[Type='CustomProvance_ServiceManager_Itam_Core_Library!Provance.ITAM.Location']/DisplayName$

However i am unable to extend the same concept to another Query String to use it three times /Path[RelationShip OR! i hava a mistake in my below query string syntax as in output rendered is the querystring as is without a result (which is often a problem)

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ReviewActivity']/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ReviewActivity']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/Property[Type='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewerIsUser' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.User']/Property[Type='CustomSystem_WorkItem_Activity_Library!System.User']/Id$ 

I need to access : ServiceRequest->ReviewActivity->Reviews->IsUser->Email Address

Any help would be appreciated.

August 12th, 2013 2:23pm

 Found a little mistake in query string and corrected as below. Still not luck though 

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ReviewActivity']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewerIsUser' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.User']/Property[Type='CustomSystem_WorkItem_Activity_Library!System.User']/UserName$ 

Free Windows Admin Tool Kit Click here and download it now
August 12th, 2013 4:39pm

Just from a first look without fully testing everything I can see, that the path to the System.User class can't be correct.

Your path is trying to access the class System.User via the same MP Alias as where the activity classes are stored: CustomSystem_WorkItem_Activity_Library. The System.User class is however in a seperated Management Pack than those for the activities. System.User is stored in System.Library Management Pack.

So you need to check if your MP where this template is stored already has a reference to the System.Library Management Pack and use then the alias instead of CustomSystem_WorkItem_Activity_Library or you add this reference with something like CustomSystem_Library and uses this alias for everything where you target the System.User class.

Are you actually using the Template tester extension by Anton Gritsenko? This is a very helpful extension for such cases, way easier to see when it's finally working instead sending everytime emails and hoping it works now :)

Here's a link to the extension: http://scsmsolutions.com/freetools/32-scsm-email-template-tester

Cheers

Alex




August 12th, 2013 5:44pm

   As for your template tester. Thanks. I feel like relieved big time. Really appreciate that.

   However as for MP names. I am referring to Excel Sheet file Uploaded on SCSM Team Blog

   Do you have any suggestions where to check the correct names and classes names as the Excel sheet turns out to be outdated or not correct, in that case

  I've tried changing the reference to System.User to CustomSystem_Library instead as below without luck though

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ReviewActivity']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewerIsUser' TypeConstraint='CustomSystem_Library!System.User']/Property[Type='CustomSystem_Library!System.User']/UserN		
Free Windows Admin Tool Kit Click here and download it now
August 12th, 2013 7:29pm

Hi there,

I've tested it now with a fresh Management Pack. Here's the path you'd have to use in your template to access ServiceRequest->ReviewActivity->Reviews->IsUser->Email Address

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ReviewActivity']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewerIsUser' TypeConstraint='System!System.User']/Path[Relationship='CustomSystem_SupportingItem_Library!System.UserHasPreference' TypeConstraint='CustomSystem_Notifications_Library!System.Notification.Endpoint']/Property[Type='CustomSystem_Notifications_Library!System.Notification.Endpoint']/TargetAddress$

There's however a downside of this: Since a user can have multiple notification properties (such as SIP when you're using Lync / other Voice Applications in your AD, SMTP for mail, etc.), all of them would be displayed in your template using this method.

I haven't figured out yet how to filter only for the SMTP address. Maybe there's a possibility to use a property filter when specifying the TypeConstraint, but I haven't seen something like this yet.

However, if you only have SMTP as a notification property for each user, then this won't affect you.

Furthermore these are the Management Pack references you'd have to add to your MP where the notification template is saved:

<Reference Alias="CustomSystem_Notifications_Library">
        <ID>System.Notifications.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="CustomSystem_WorkItem_Activity_Library">
        <ID>System.WorkItem.Activity.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="CustomSystem_SupportingItem_Library">
        <ID>System.SupportingItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="System">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>

If you do already have a reference to one of these Management Packs in your MP where you store the template, then you have to adjust the corresponding alias in my query path above to match your existing MP alias.

Hope that helps.

BR

Alex

August 14th, 2013 12:03pm

Thanks Alexander for the pointing to right direction. Indeed it was only about missing references in MP.

However correct list of references needed are as below to get to the email address. (it lists all addresses even the SIP address also to be sorted out). I've verified the references in fresh MP. It does include some external references like Provance ITAM solution for SCSM which can be excluded for normal cases.

<References>
      <Reference Alias="EnterpriseManagement">
        <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomSystem_Notifications_Library">
        <ID>System.Notifications.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomSystem_WorkItem_Activity_Library">
        <ID>System.WorkItem.Activity.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomSystem_Library">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomSystem_SupportingItem_Library">
        <ID>System.SupportingItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="EnterpriseManagement1">
        <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>
        <Version>7.5.2905.125</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomSystem_WorkItem_Library">
        <ID>System.WorkItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomSystem_ServiceCatalog_Library">
        <ID>System.ServiceCatalog.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
 	<Reference Alias="CustomProvance_ServiceManager_Itam_Hardware_Library">
        <ID>Provance.ServiceManager.Itam.Hardware.Library</ID>
        <Version>2.0.6073.0</Version>
        <PublicKeyToken>7c0e08a556dae555</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomMicrosoft_Windows_Library">
        <ID>Microsoft.Windows.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
	<Reference Alias="SMServiceRequest">
        <ID>ServiceManager.ServiceRequest.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="CustomProvance_ServiceManager_Itam_Core_Library">
        <ID>Provance.ServiceManager.Itam.Core.Library</ID>
        <Version>2.0.6073.0</Version>
        <PublicKeyToken>7c0e08a556dae555</PublicKeyToken>
      </Reference>
<References>
This above for SCSM 2012 sp
Free Windows Admin Tool Kit Click here and download it now
August 16th, 2013 2:11pm

Is there a way to embed a criteria in this /path statement so that only SMTP email address is retrieved ?            

                <Criteria xmlns=""http://Microsoft.EnterpriseManagement.Core.Criteria/"">
                  <Reference Id=""System.Notifications.Library"" PublicKeyToken=""{0}"" Version=""{1}"" Alias=""NotifLib"" />
                  <Expression>
                    <And>
                      <Expression>
                        <SimpleExpression>
                          <ValueExpressionLeft>
                            <Property>$Target/Property[Type='NotifLib!System.Notification.Endpoint']/TargetAddress$</Property>
                          </ValueExpressionLeft>
                          <Operator>Equal</Operator>
                          <ValueExpressionRight>
                            <Value>foo@bar.com</Value>
                          </ValueExpressionRight>
                        </SimpleExpression>
                      </Expression>
                      <Expression>
                        <SimpleExpression>
                          <ValueExpressionLeft>
                            <Property>$Target/Property[Type='NotifLib!System.Notification.Endpoint']/ChannelName$</Property>
                          </ValueExpressionLeft>
                          <Operator>Equal</Operator>
                          <ValueExpressionRight>
                            <Value>SMTP</Value>
                          </ValueExpressionRight>
                        </SimpleExpression>
                      </Expression>
                    </And>
                  </Expression>
                </Criteria>

August 16th, 2013 3:30pm

  I found the above assumption to wrong. It was only a syntax mistake. Both Review activity can access SR and then further next child items from that SR. Keep adding /Path relationship string with only seedrole='Target' to reach up to the parent SR and you are done.

Free Windows Admin Tool Kit Click here and download it now
September 24th, 2013 11:57pm

Hi there,

I've tested it now with a fresh Management Pack. Here's the path you'd have to use in your template to access ServiceRequest->ReviewActivity->Reviews->IsUser->Email Address

$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ReviewActivity']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewActivityHasReviewer' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.Reviewer']/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.ReviewerIsUser' TypeConstraint='System!System.User']/Path[Relationship='CustomSystem_SupportingItem_Library!System.UserHasPreference' TypeConstraint='CustomSystem_Notifications_Library!System.Notification.Endpoint']/Property[Type='CustomSystem_Notifications_Library!System.Notification.Endpoint']/TargetAddress$

There's however a downside of this: Since a user can have multiple notification properties (such as SIP when you're using Lync / other Voice Applications in your AD, SMTP for mail, etc.), all of them would be displayed in your template using this method.

I haven't figured out yet how to filter only for the SMTP address. Maybe there's a possibility to use a property filter when specifying the TypeConstraint, but I haven't seen something like this yet.

However, if you only have SMTP as a notification property for each user, then this won't affect you.

Furthermore these are the Management Pack references you'd have to add to your MP where the notification template is saved:

<Reference Alias="CustomSystem_Notifications_Library">
        <ID>System.Notifications.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="CustomSystem_WorkItem_Activity_Library">
        <ID>System.WorkItem.Activity.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="CustomSystem_SupportingItem_Library">
        <ID>System.SupportingItem.Library</ID>
        <Version>7.5.2905.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="System">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>

If you do already have a reference to one of these Management Packs in your MP where you store the template, then you have to adjust the corresponding alias in my query path above to match your existing MP alias.

Hope that helps.

BR

Alex


thank you Alex for sharing this! that helps me alot..
December 18th, 2013 2:55pm

As this is on topic of what I'm searching for...  Is there a way from the Review Activity email template to pull the Service Request ID, which I would assume would be the parent ID?  I can't figure out how to get this SR##### from the RA email template to display.  Thanks!
Free Windows Admin Tool Kit Click here and download it now
January 17th, 2014 11:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics