Home Service Manager

Using multiple SLA TargetEndDate timestamps inside mail templates

Frederik_VandendriesFrederik_Vandendries Customer IT Monkey ✭
I have 2 SLA's defined for incidents and I want to use both TargetEndDates inside a mail template.
Through the property builder I can only insert this property for TargetEndDate:

$Context/Path[Relationship='CustomSystem_SLA_Library!System.WorkItemHasSLAInstanceInformation' TypeConstraint='CustomSystem_SLA_Library!System.SLA.Instance.TimeInformation']/Property[Type='CustomSystem_SLA_Library!System.SLA.Instance.TimeInformation']/TargetEndDate$

If I test this template on an incident with 2 SLA's, then I get the 2 timestamps back in one line, separated wih semicolon:

17-6-2016 8:17:03; 17-6-2016 11:17:03

Through powershell I could see that there is indeed a collection of 2 objects of type System.SLA.Instance.TimeInformation. But I can't find the syntax to write a single TargetEndDate in the mailtemplate.
In powershell its more simple:

$IR = Get-SCSMObject -Class (Get-SCSMClass -Name "System.WorkItem.Incident$") -Filter "Name = 'IR59920'"
$rel = Get-SCSMRelationshipClass -Name "System.WorkItemHasSLAInstanceInformation$"
$SLA = Get-SCSMRelatedObject -SMObject $IR -Relationship $rel
$SLA[0].TargetEndDate
$SLA[1].TargetEndDate

Thanks
Frederik

Comments

  • Brett_MoffettBrett_Moffett Cireson PACE Super IT Monkey ✭✭✭✭✭
    That's a tough one.
    As the e-mail template is only HTML and most mail clients (Outlook etc.) won't allow scripts to run in the HTML content then I can not see how it would be possible to split the two returned values across on to separate lines.

    I'm not sure it's even possible without dropping out to a Runbook or other method for sending the e-mail
Sign In or Register to comment.