Examples of Notification Object Scripting

ClosedExample 1: Retrieving the user who has started the object plus the corresponding department

:ADD_ATT can be used to add this user as a receiver. Therefore, you can also process CALL.ALARM objects even without specifying a receiver.

!Get Operator
:set &userid# = SYS_USER_NAME
:set &dep# = SYS_USER_DEP
:ADD_ATT OPERATOR, '&userid#/&dep#'
!

ClosedExample 2: Retrieving the name, RunID, status and return code of the task that triggered the Notification object

!Get Script
:read &UC_CAUSE_NAME,,
:read &UC_CAUSE_NR,,
:read &UC_CAUSE_STATE,,
:read &UC_CAUSE_RETCODE,,
!
:set &nl# = UC_CRLF ()
!

ClosedExample 3: Retrieving the name, RunID and object type of the superordinate task that has activated the Notification object

Additionally, the Automation Engine system name, client number, time and date of activation as well as the language are queried. The script element GET_MSG_TEXT() supplies the status text of the task that caused the notification to start.

:set &parentname# = SYS_ACT_PARENT_NAME('ACT')
:set &parentnr# = SYS_ACT_PARENT_NR('ACT')
:set &parenttyp# = SYS_ACT_PARENT_TYP('ACT')
:set &system# = GET_UC_SYSTEM_NAME
:set &client# = SYS_ACT_CLIENT
:set &date# = SYS_DATE_PHYSICAL()
:set &time# = SYS_TIME_PHYSICAL("HH:MM:SS")
:set &lang# = SYS_USER_LANGUAGE
:set &statustext# = get_msg_txt(&UC_CAUSE_STATE,'')
!

ClosedExample 4: After a language check, the retrieved information is written to the message text in German, English or French using the script element :PUT_ATT or :PUT_ATT_APPEND

English

:if &lang# = 'E'
!: put_att SUBJECT = "Alarm:'&UC_CAUSE_NAME' RunID:'&UC_CAUSE_NR' Client:'&client#'
: set &date# = conv_date(&date#,"MM/DD/YYYY")
: PUT_ATT CALL_TEXT = "An error occurred! &nl# &nl#"
: put_att_append CALL_TEXT = "AE system: &system# &nl#"
: put_att_append CALL_TEXT = "Client: &client# &nl#"
: put_att_append CALL_TEXT = "Object: &UC_CAUSE_NAME &nl#"
: put_att_append CALL_TEXT = "Run#: &UC_CAUSE_NR &nl#"
: put_att_append CALL_TEXT = "State Text: &statustext# (&UC_CAUSE_STATE) &nl#"
: put_att_append CALL_TEXT = "Retcode: &UC_CAUSE_RETCODE &nl#"
: put_att_append CALL_TEXT = "Date/Time: &date# &time# &nl# &nl#"
: put_att_append CALL_TEXT = "Parent of this object (if available): &nl# &nl#"
: put_att_append CALL_TEXT = "Parent: &parentname# &nl#"
: put_att_append CALL_TEXT = "Type: &parenttyp# &nl#"
: put_att_append CALL_TEXT = "Run#: &parentnr# &nl#"
:endif

German

:if &lang# = 'D'
!: put_att SUBJECT = "Alarm:'&UC_CAUSE_NAME' RunID:'&UC_CAUSE_NR' Client:'&client#'
: set &date# = conv_date(&date#,"MM/DD/YYYY")
: PUT_ATT CALL_TEXT = "Ein Fehler ist aufgetreten! &nl# &nl#"
: put_att_append CALL_TEXT = "AE system: &system# &nl#"
: put_att_append CALL_TEXT = "Mandant: &client# &nl#"
: put_att_append CALL_TEXT = "Objekt: &UC_CAUSE_NAME &nl#"
: put_att_append CALL_TEXT = "Run#: &UC_CAUSE_NR &nl#"
: put_att_append CALL_TEXT = "Status: &statustext# (&UC_CAUSE_STATE) &nl#"
: put_att_append CALL_TEXT = "Retcode: &UC_CAUSE_RETCODE &nl#"
: put_att_append CALL_TEXT = "Datum/Zeit: &date# &time# &nl# &nl#"
: put_att_append CALL_TEXT = "Parent dieses Objektes (wenn vorhanden): &nl# &nl#"
: put_att_append CALL_TEXT = "Parent: &parentname# &nl#"
: put_att_append CALL_TEXT = "Typ: &parenttyp# &nl#"
:put_att_append CALL_TEXT = "Run#: &parentnr# &nl#"
:endif

French

:if &lang# = 'F'
!: put_att SUBJECT = "Alarm:'&UC_CAUSE_NAME' RunID:'&UC_CAUSE_NR' Client:'&client#'
: set &date# = conv_date(&date#,"MM/DD/YYYY")
: PUT_ATT CALL_TEXT = "Une erreur s'est produite! &nl# &nl#"
: put_att_append CALL_TEXT = "AE system: &system# &nl#"
: put_att_append CALL_TEXT = "Client: &client# &nl#"
: put_att_append CALL_TEXT = "Objet: &UC_CAUSE_NAME &nl#"
: put_att_append CALL_TEXT = "Run#: &UC_CAUSE_NR &nl#"
: put_att_append CALL_TEXT = "Statut: &statustext# (&UC_CAUSE_STATE) &nl#"
: put_att_append CALL_TEXT = "Retcode: &UC_CAUSE_RETCODE &nl#"
: put_att_append CALL_TEXT = "Date/Heure: &date# &time# &nl# &nl#"
: put_att_append CALL_TEXT = "Parent de cet objet (si disponible): &nl# &nl#"
: put_att_append CALL_TEXT = "Parent: &parentname# &nl#"
: put_att_append CALL_TEXT = "Type: &parenttyp# &nl#"
: put_att_append CALL_TEXT = "Run#: &parentnr# &nl#"
:endif

:if &lang# = 'F'

!: put_att SUBJECT = "Alarm:'&UC_CAUSE_NAME' RunID:'&UC_CAUSE_NR' Client:'&client#'

: set &date# = conv_date(&date#,"MM/DD/YYYY")

: PUT_ATT CALL_TEXT = "Une erreur s'est produite! &nl# &nl#"

: put_att_append CALL_TEXT = "AE system: &system# &nl#"

: put_att_append CALL_TEXT = "Client: &client# &nl#"

: put_att_append CALL_TEXT = "Objet: &UC_CAUSE_NAME &nl#"

: put_att_append CALL_TEXT = "Run#: &UC_CAUSE_NR &nl#"

: put_att_append CALL_TEXT = "Statut: &statustext# (&UC_CAUSE_STATE) &nl#"

: put_att_append CALL_TEXT = "Retcode: &UC_CAUSE_RETCODE &nl#"

: put_att_append CALL_TEXT = "Date/Heure: &date# &time# &nl# &nl#"

: put_att_append CALL_TEXT = "Parent de cet objet (si disponible): &nl# &nl#"

: put_att_append CALL_TEXT = "Parent: &parentname# &nl#"

: put_att_append CALL_TEXT = "Type: &parenttyp# &nl#"

: put_att_append CALL_TEXT = "Run#: &parentnr# &nl#"

:endif

See also:

Using Scripts to Read Variables from the Read Buffer