Passing information about UI objects to a java agent

The lotus java agents don’t have classes to manage the UI objects, such as in LotusScript with the classes NotesUIDocument or NotesUIView.
It’s true that you can find several info about the Notes Client Java UI API in internet, but these classes are not officially supported.
In this post I explain 3 ways to obtain the currently open view or document inside an agent java.
You take advantage of the LotusScript UI classes that can easily manage the UI objects, and you pass them to the java agent using the variables in the notes.ini or a profile document or a notes document.

  • first method: notes.ini
    1. create a lotusscript agent called “save UI info in notes.ini” and with Trigger “Action menu selection” and Target “None”
    2. create a java agent called “get UI info from notes.ini” and with Trigger “Action list selection” and Target “None”
  • second method: profile document
    1. create a lotusscript agent called “save UI info in profile document” and with Trigger “Action menu selection” and Target “None”
    2. create a java agent called “get UI info from profile document” and with Trigger “Action list selection” and Target “None”

In both cases, launch the lotusScript agent from a view (Actions menu), and the name of the view is displayed on the java console.


You can also pass a document noteID to the java agent as a parameter of the method “Run” of the lotusscript class NotesAgent.
In the following example you see as you can pass the backend document corresponding to the currently open document.

  • third method: notes document as parameter of Run method
    1. create a lotusscript agent called “Pass notesuidocument to java agent” and with Trigger “Action menu selection” and Target “None”
    2. create a java agent called “get notesuidocument from lotusscript agent” and with Trigger “Action list selection” and Target “None”

      This last example must be run from an open document and shows the noteID on the java console.
      The java agent can’t modify the document on the screen but can modify the backend document.

One Reply to “Passing information about UI objects to a java agent”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.