Skip to main content link. Accesskey S

XPages Wiki

Submit Search

YouAtNotes XPages Wiki


Home > Work with agents

Work with agents

ShowTable of Contents

Running an agent


You can run any LotusScript or Java agent using this:

var agent=database.getAgent("myagent");
agent.run(currentDocument.getNoteID()); 


In the agent you get the noteID (not the UniversalID) and get a handle to the current document as follows:

Dim session as new notesSession
Dim agent as notesAgent
Dim doc as notesDocument

set agent = session.currentAgent
set doc = session.currentDatabase.getDocumentById(agent.parameterDocId)


The server side javascripts waits until the agent is finished.

Since 8.5.2: run agent with an in-memory document


Since Domino 8.5.2 you can execute an agent with a new option:

agent.runWithDocumentContext(doc:NotesDocument)


and in the agent you can get the in-memory document with

set doc = session.documentContext


Then you can change fields in the document and you DO NOT NEED to save it.
When the agent is done and execution goes back to server side javascript, the changes from the agent are reflected in the XPage backend document.
See what's possible with Xpages.
Have a look at our ServiceCommunicator website
and the YouAtNotes Support.
Use  searchlotus.com  for news in the Web related to Lotus Notes and Domino,
and to search those sites.
Check  youatnotes.com  for great Lotus Notes, Domino and XPages software.
Did this wiki help you?
Did this saved you time? Express your gratitude by making a donation:
PayPal - The safer, easier way to pay online!