Appendix A. FRM105
FRM105 - A Trigger Function
Code to complete trigger function iiiFN02
Subroutine Name(SEND_EMAIL)
* COMMENT()
Use Builtin(MAIL_START)
* COMMENT(Set Mail Orginator Address)
Change Field(#STD_TEXT) To('[email protected]')
Use Builtin(MAIL_ADD_ORIGINATOR) With_Args('Salary Trigger' #std_text) To_Get(#io£sts)
Execute Subroutine(checksts)
* COMMENT(Set mail recipient address)
#std_textl := 'SMTP:[email protected]'
Use Builtin(MAIL_ADD_RECIPIENT) With_Args(TO 'JM Ivory' #std_textl) To_Get(#io£sts)
Execute Subroutine(checksts)
* COMMENT()
#std_descl := (#surname + '(' + #EMPNO + ') Exceeded allowed salary change')
Use Builtin(MAIL_SET_SUBJECT) With_Args(#Std_descl) To_Get(#io£sts)
Execute Subroutine(checksts)
* COMMENT()
Execute Subroutine(ADD_TEXT)
* COMMENT()
Use Builtin(MAIL_SEND) To_Get(#io£sts)
Execute Subroutine(checksts)
Endroutine
Subroutine Name(checksts)
If (#io£sts *NE OK)
Message Msgtxt('Email service response was :' + #io£sts)
Endif
Endroutine
* COMMENT()
Subroutine Name(ADD_TEXT)
* COMMENT()
* COMMENT()
Use Builtin(MAIL_ADD_TEXT) With_Args('HI,')
Use Builtin(MAIL_ADD_TEXT) With_Args(*BLANK)
#fullname := #Surname + ',' + #givename
#std_instr := (#Fullname + 'has received a salary increase of ' + #increase.asstring)
Use Builtin(MAIL_ADD_TEXT) With_Args(#std_instr)
#std_instr := 'This exceeds allowable limits. Please confirm'
Use Builtin(MAIL_ADD_TEXT) With_Args(*BLANK)
Use Builtin(MAIL_ADD_TEXT) With_Args(*BLANK)
#std_instr := 'Click on the following link to confirm salary change'
Use Builtin(MAIL_ADD_TEXT) With_Args(#std_instr)
Use Builtin(MAIL_ADD_TEXT) With_Args(*BLANK)
Use Builtin(MAIL_ADD_TEXT) With_Args(*BLANK)
* COMMENT(URL for WAM to confirm salary change)
* COMMENT(Change service name using your initials)
#std_qsel := ('http://localhost/CGI-BIN/lansaweb?srve=iiiEMPSAL+ml=LANSA:XHTML+part=DEM+lang=ENG+f(EMPNO)=' + #EMPNO)
Use Builtin(MAIL_ADD_TEXT) With_Args(#std_qsel)
Use Builtin(MAIL_ADD_TEXT) With_Args(*BLANK)
#std_instr := 'Set Business Phone to A100 to confirm'
Use Builtin(MAIL_ADD_TEXT) With_Args(#std_instr)
Use Builtin(MAIL_ADD_TEXT) With_Args(*BLANK)
#std_instr := 'Message sent automatically by Employee Trigger'
Use Builtin(MAIL_ADD_TEXT) With_Args(#std_instr)
Endroutine