Retrieving changes made by a Java Agent on a document

后端 未结 2 1585
时光取名叫无心
时光取名叫无心 2021-01-23 01:54

I am passing parameters to a Java agent from Lotus Script like this:

Set db = session.CurrentDatabase    
Set doc = db.CreateDocument     
Set uiDoc = workspace.         


        
相关标签:
2条回答
  • 2021-01-23 02:26

    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()
    
    0 讨论(0)
  • 2021-01-23 02:47

    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)
    
    0 讨论(0)
提交回复
热议问题