David Foard · 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.

0 1,097
Discussion (3)2
Log in or sign up to continue

%Ensemble("SessionId") does hold the session id, but by using it you're breaking the abstraction barrier.  There's no guarantee that variable name will continue to be used in future versions.  Why do you need the SessionId in a DTL?  There may be a better way to solve the problem you're trying to solve.

Hi David,

$$$JobSessionId should work. That will return the session ID for the message being processed if there is one. Brendan, is there any reason that David should not use this? 

As a note, when we create a new Ens.AlertRequest, we call  %OnNew and do the following 

Set ..SessionId = $get($$$JobSessionId)


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 ).