This is "Agent to be run LotusScript."
Sub Initialize Dim s As New NotesSession Dim agent As NotesAgent Set agent = s.CurrentAgent Dim db As NotesDatabase Set db = s.CurrentDatabase Dim memo As New NotesDocument(db) memo.Form = "Memo" memo.SendTo = s.UserName memo.Subject = "Message from LotusScript agent" memo.Body = "The agent is running as " & s.UserName Call memo.Send(False) End Sub
This is "Agent to be run parameter LotusScript." It accesses the passed note ID through ParameterDocID, accesses the referenced document, and removes it.
Sub Initialize Dim s As New NotesSession Dim agent As NotesAgent Set agent = s.CurrentAgent Dim db As NotesDatabase Dim doc As NotesDocument Set db = s.CurrentDatabase REM Get document used for passing data Set doc = db.GetDocumentByID(agent.ParameterDocID) REM Send mail containing passed data Dim memo As New NotesDocument(db) memo.Form = "Memo" memo.SendTo = s.UserName memo.Subject = "Message from LotusScript agent" memo.Body = "The agent was started by " _ & doc.TriggerUserName(0) Call memo.Send(False) REM Delete document used for passing data Call doc.Remove(True) End Sub