· Jul 8, 2016

Use SessionId as value for target field

Can you assign the SessionId to a target field in a DTL. There is a %Ensemble("SessionId") variable that looks like it would be available to use.

Discussion (4)3
Log in or sign up to continue

I have been struggling with "Managed Alerts" and trying to make betters sense of the emails recieved.

This was most helpful because I would like to pinpoint the system and SessionId where the error/warning occurred... well, the "ManagedAlert.SessionId" was not being populated in the Ens.Alerting.NofificationRequest so this was able to capture in the DTL.  Thanks so much for that advice. Now however, it is not populating in the email received... i.e. the "Session" is then Instance name, as is the "System" name...  I'm still trying to find out where these variables are being set and how, if possible, to modify to set them?  Any assistance would be greatly appreciated!  (IRIS for Health version 2020.1 ). 



To make it easy to get the SessionId from DTL, BPL, or rules, where the $$$JobCurrentHeaderId macro is not defined, add methods like these to your extended function class that Extends Ens.Rule.FunctionSet:

/// Return the current Ens.MessageHeader Id
ClassMethod XCurrentMessageHeaderId() As %String [ CodeMode = expression ]

/// Return the current SessionId
ClassMethod XSessionId() As %String [ CodeMode = expression ]

/// Return the current SuperSession
ClassMethod XSuperSession() As %String [ CodeMode = expression ]