Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search

Available in the Appstore!All the content of xpageswiki.com for iPhone or iPad for offline access.

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.

Add Comment

Name:
Comments:
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 information help you?
Please honor our efforts and flattr this!