Getting the current document from a button in an embedded editor

Consider the following scenario:
a lotus form containing an embedded view and an embedded editor, the 2 embedded controls are linked together according to targeting by linking an embedded editor to an embedded view.
The embedded editor contains a button that tries to get the current document (often called uidoc) with the code:

but this code returns the NotesUIDocument of the document linked to the embedded editor and not the NotesUIDocument linked to the main document.
To get the current document you have to:

  1. declare a global variable in the form of the embedded editor under (Globals) -> (Declarations)
  2. modify the event (Globals) -> Initialize where you initialize uidoc

Now the variable uidoc points to the current document and being a global variable you can use in the Click event of the button and in other parts of the embedded editor.

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.