Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search


Home > Work with agents
xpageswiki.com
is maintained by 
Julian Buss.
You can hire me.

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:
How to take your XPages App to the iPhone, iPad, Android: use Domino To Go!
Do you look for an XPages Workflow solution? Take YouAtNotes Workflow.