APPLICATION DESIGN


Examples of agents to run before Web users open or save documents
To perform error checking, field validation, and other processing before Web users open or save documents, create a shared agent that runs manually. Then write a formula that uses @Command([RunAgent]) or @Command([ToolsRunMacro]) to run the agent and attach it to the WebQueryOpen or WebQuerySave form events. This simulates the LotusScript QueryOpen and QuerySave form events that arenft supported on the Web.

WebQueryOpen events

A WebQueryOpen event runs the agent before Domino converts a document to HTML and sends it to the browser. IBMR LotusR Domino(TM) ignores any output produced by the agent in this context.

Examples for using this agent include performing large computations that arenft possible with @commands or collecting statistics about who opened documents and when they did so.

Note WebQueryOpen agents run when the user opens a form or document, but do not run when the user saves a document. This means that computed fields set by a WebQueryOpen agent are not saved when the user submits a document. To make sure computed fields are saved, you can either recalculate them in the WebQuerySave agent or set the form property "Generate HTML for all fields."

WebQuerySave events

A WebQuerySave event runs the agent after field input validation formulas are run and before the document is actually saved to disk or mailed. The agent can modify the document or use the document data to perform other operations. The document is automatically saved after the agent runs. Do NOT have the agent explicitly save the document (for example, by calling NotesDocument.Save) because an explicit save could cause incorrect results.

A WebQuerySave agent can produce output to be sent back to the user. For example in a LotusScript agent, you can use the Print command to return raw HTML. If the agent produces output, then the form should not have a $$Return field because Domino will return only the agent output and ignore the field.

Examples for using this agent include:


Note The SaveOptions field must be an existing field on the form, which the WebQuerySave agent changes the value of. If the agent creates the SaveOptions field, the form will be saved regardless of the value in that field.