LOTUSSCRIPT/COM/OLE CLASSES
Read-only. The in-memory document when an agent starts.
Note This property is not implemented in COM.
Defined in
NotesSession
Data type
NotesDocument
Syntax
To get: Set notesDocument = notesSession.DocumentContext
Usage
For an agent activated in a view through the Notes client UI, the in-memory document is the document highlighted in the view.
For an agent activated "Before New Mail Arrives," the in-memory document is the email that is about to be delivered. Because the agent is activated instantly for each email as it's about to be saved into the mail database, each time the agent runs you are working with a single unsaved document. The NotesDatabase.UnprocessedDocuments property will not return any documents for this agent type.
For an agent run from a browser with the OpenAgent URL command, the in-memory document is a new document containing an item for each CGI (Common Gateway Interface) variable supported by Domino. Each item has the name and current value of a supported CGI variable. (No design work on your part is needed; the CGI variables are available automatically.)
For an agent run from a browser with @Command([RunAgent]) or @Command[ToolsRunMacro], the in-memory document is the current document. In the case of WebQueryOpen, this is the document before Domino converts it to HTML and sends it to the browser; in the case of WebQuerySave, this is the document before Domino saves it. If the form on which the document is based contains a field named the same as a Domino-supported CGI variable, the in-memory document also contains the value of that variable. (You must explicitly design the CGI variables into the form, for example, as hidden fields.)
See "Table of CGI Variables" in Application Development with Domino Designer for a list of the Domino-supported CGI variables.
Through the C or C++ API, an external program can create an in-memory document, then run an agent. The agent can use this property to access the in-memory document.
The Save method immediately updates the document represented by the NotesDocument object returned by DocumentContext. For an agent working on a selected document in the Notes client, you must save before exiting to preserve any changes. For an agent called from a browser, any changes go back to the browser when the agent exits; you probably do not want to save before exiting, but let the browser handle the changes.
You cannot use the encrypt and remove methods on the NotesDocument object returned by DocumentContext, nor use the compact method on the NotesDatabase object that contains the NotesDocument object returned by DocumentContext.
Language cross-reference
DocumentContext property in Java AgentContext class
Example