I am passing parameters to a Java agent from Lotus Script like this:
Set db = session.CurrentDatabase
Set doc = db.CreateDocument
Set uiDoc = workspace.
You have to save the doc in your Java code and to re-read your doc in LotusScript after calling your agent.
It is easier to use an In-Memory Document though:
LotusScript
MyAgent.RunWithDocumentContext(doc, doc.NoteID)
Java
Document doc = agentContext.getDocumentContext()
If for some reason you cannot use RunWithDocumentContext
(in earlier versions of Lotus Notes) then you need to reopen document:
Set db = session.CurrentDatabase
Set doc = db.CreateDocument
Call doc.AppendItemValue("fileName", "SomeString" )
Call doc.Save(True, False)
noteID$ = doc.NoteID
Set MyAgent = db.GetAgent("AgentName")
Call MyAgent.Run(noteID$)
'Delete document from memory.
Delete doc
'Get updated document.
Set doc = db.GetDocumentByID(noteID$)
result = doc.GetItemValue("Result")(0)