Writing scripts and formulas for agents

An agent is a user procedure that you can trigger through a number of mechanisms. An agent runs on:

  • The user's workstation if the agent's trigger is "Action menu selection," "Agent list selection," or "When documents are pasted."
  • The server or workstation containing the agent if the agent's trigger is "Before new mail arrives," "After new mail has arrived," or "After documents are created or modified," or any of the "On schedule" options.

You can code agents in the formula language, LotusScript, and Java, and you can use Domino-supplied agents. Before writing your own agent, see if a Domino-supplied agent will do the job.

Formula-based agents run iteratively on the documents in the database, unless you select None in the agent's target option. You can also apply search criteria through the agent interface to specify which documents in the database are to be processed. A SELECT statement in the formula further limits the search. If you do not include a SELECT statement in the formula, Domino Designer appends a "SELECT @All" statement. Except for "SELECT @All," a SELECT statement must be the first statement in the formula to be effective.

@Commands are only allowed in agents that specify None in the target option.

LotusScript and Java agents run once. You supply the search criteria and the iteration through the language constructs. Search criteria applied through the agent interface are effective only through UnprocessedDocuments in NotesDatabase (LotusScript) or UnprocessedDocuments in AgentContext (Java).