Examples: CurrentAgent property

  1. This agent script gets the name of the agent that's currently running and puts it into agentName. For example, if this script is a part of the Super Agent, the Name property returns "Super Agent."
    Dim session As New NotesSession
    Dim agent As NotesAgent
    Dim agentName As String
    Set agent = session.CurrentAgent
    agentName = agent.Name
  2. This agent script creates a mail log for the agent that's currently running. The log has the same name as the current agent and gets mailed to the current agent's owner.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim agent As NotesAgent
      Set db = session.CurrentDatabase
      Set agent = session.CurrentAgent
      Dim currentLog As NotesLog
      Set currentLog = New NotesLog( agent.Name )
      Call currentLog.OpenMailLog _
      ( agent.Owner, agent.Name & " in " & db.Title )
      '...log some actions and errors...
      Call currentLog.Close
    End Sub