Guillaume Lepretre · Jun 20, 2018

[Intersystems 2017] Use the email alert request


I used the operation : EnsLib.EMail.AlertOperation to send mail to handle error. However, I want to get more information about the error (session ID message, the date, the namespace... etc).

what is the best way to do it?

I tried to add informations in OnAlertRequest method as below but I need to change mail operation from all namespaces...

0 461
Discussion (4)0
Log in or sign up to continue

Some ideas:

  • session ID - you're getting it with pAlertRequest.SessionId, no?
  • date - get it from pAlertRequest.AlertTime
  • namespace -wouldn't it always be the current namespace? Get it with $namespace

What other data do you need?

Also, please post your code as text.

You already have a value of SessionId, so concatenate the rest?

To get port and host call:

set sc=##class(%Studio.General).GetWebServerPort(.port, .server)

You can do it in three ways:

1 -

set ^mtemperro($ZNSPACE,..%PackageName()_"."_..%ClassName(),$horologmensagem_" Erro CACHE: "_$zerror_" - "_$SYSTEM.OBJ.DisplayError()

2 -
Throw ##class(%Exception.General).%New("Falha ao sinalizar o lançamento do PDA como rastreado.",1,..%ClassName()_".upByRastreado","Informe ao suporte sobre o problema.").Log()

3 - Declare in your class an exception variable

#dim exception As% Exception.AbstractException

catch exception {
    do exception.Log()

Then just check the cache administration portal:

System Operation-> System Logs-> Application Error Log