Accessing agents

The NotesAgent class represents an agent. You can access the current agent through the CurrentAgent property of NotesSession; this property is empty if the script is not running as an agent. You can access all agents in a database through the Agents property of NotesDatabase; this property is empty if the database contains no agents. You can access a named agent in a database through the GetAgent method of NotesDatabase.

The following table lists the NotesAgent properties:

Property

Data type

Description

Comment

String

(Read-only) Comment entered by agent designer

CommonOwner

String

(Read-only) Common name of the user who last modified the agent

HasRunSinceModified

Boolean

(Read-only) True if the agent has run since it was created or last modified

HttpURL

String

(Read-only) The HTTP URL of an agent.

IsActivatable

Boolean

(Read-only) True if user activation is in effect when enabling an agent.

IsEnabled

Boolean

(Read-write) True if the agent can run.

IsNotesAgent

Boolean

(Read-only) True if the agent can run in the Domino® client environment

IsPublic

Boolean

(Read-only) True if the agent is public

IsWebAgent

Boolean

(Read-only) True if the agent can run in a Web browser environment

LastRun

Date variant

(Read-only) Date that the agent last ran

Name

String

(Read-only) Name of the agent

NotesURL

String

(Read-only) The Notes® URL of an agent.

OnBehalfOf

String

(Read-only) Name of user under whose identity a scheduled or Web agent runs.

Owner

String

(Read-only) Name of the creator of the agent

ParameterDocID

String

(Read-only) The note ID of a document

Parent

NotesDatabase

(Read-only) Database that contains the agent

Query

String

(Read-only) Query used by the agent to select documents

ServerName

String

(Read-write) Name of the server on which the agent runs

Target

Boolean or Constant

(Read-only) Indicates which documents the agent acts on

Trigger

Boolean or Constant

(Read-only) Indicates when the agent runs

The NotesAgent class contains a Remove method to remove the agent from the database.

The SavedData property of NotesSession returns a NotesDocument object. The agent can use this document to store data that is persistent across invocations of the agent. However, if the agent is modified in any way, the saved data document is cleared. This document is not accessible from the parent NotesDatabase object or from a NotesView object.

The Run method runs the agent on the computer running the current program. The RunOnServer method runs the agent on the computer containing the agent's database.

The GetPerformanceDocument method returns the latest profiling results for the agent.