Run Agent on New or Existing XPage Document After Save

Mindwatering Incorporated

Author: Tripp W Black

Created: 08/19/2010 at 02:30 AM

 

Category:
Notes Developer Tips
XPages

Issue:
You miss the WQS (WebQuerySave) agent capability and would love to further process or reuse old complicated workflow code.

Solution:
Add this script as a server side script after the save document event action.

var agent.NotesAgent = database.getAgent("myagent");
agent.run(datasourcename.getDocument().getNoteID());


Your LotusScript agent would get the the document via its session properties:
Dim s as New NotesSession
Dim db as NotesDatabase ' this db
Dim curAgent as NotesAgent ' current wqs agent running
Dim myDoc as NotesDocument ' document to process

' setup environment
Set db = s.CurrentDatabase
Set curAgent = s.CurrentAgent
Set myDoc = db.getDocumentByID(agent.parameterDocID);
...


previous page