Agent for Event Handler

Mindwatering Incorporated

Author: Tripp W Black

Created: 07/29/2008 at 02:53 PM

 

Category:
Notes Developer Tips
LotusScript

Need:
Ability to take a handler and have it run custom code as a handler.

Solution:
Use s.DocumentContext to get the handler document. Use the handler's fields to gather info needed for agent.

Sub Initialize
' agent processes the action of an agent handler
Dim s as New NotesSession
Dim db as NotesDatabase ' current db
Dim doc as NotesDocument ' event handler document w/error information

' setup environment
Set db = s.CurrentDatabase
Set doc = s.DocumentContext

' get info desired from doc

%Rem
' fields in event handler that are useful:
EventText TEXT Text of event
TargetServer TEXT Target server for this event
EventTime TIMEDATE Time and date stamp of event
EventType NUMBER Type of event
EventSeverity NUMBER Severity of event
EventPrams TEXT Text parameters in event
ErrorCode TEXT Event type error code
OriginatingServer TEXT Server that originated the event
EventSeverityText TEXT Textual representation to Severity
EventTypeText TEXT Textual representation to Type
%End Rem

Call DoSomething(doc.ErrorCode(0), doc.EventText(0), doc.OriginatingServer(0))

Print "(ehMyHander) Done."
Exit Sub
End Sub

previous page