28 July, 2011 10:49:20 Miguel Calvo XPages English | Comentarios (0)
I hadn't had the need of using the new 8.5.2 method runWithDocumentContext yet. It's useful to make use of your Java or LotusScript libraries in XPages development. It allows to simulate the "classic" WebQuerySave and WebQueryOpen events from SSJS.
You can pass an in-memory document to a LotusScript or Java agent that can instantiate it by using the NotesSession.DocumentContext ( in LS) property from the NotesSession LS class.
It's absolutelly necessary that the agent has the option "Run as web user" checked
if you don't want to get this cryptical error:
Exception occurred calling method NotesAgent.runWithDocumentContext(lotus.domino.local.Document) null
Testing its behaviour
To test its behaviour I'm using a LotusScript agent that changes the contents of a field in the document passed to it.
doc.field = "newvalue"