>>>>>>>Observation
Scenario for Target and Pointer database setup:
1. Target database - It contains user records with some basic user information.
2. Pointer database - It contains pointer documents. After creating some user records in the target database, create some pointers in the Pointer database.
These documents contains information of where the target document resides. When opening these documents in the view Pointers, the Queryopendocument intercepts opening the document in the Pointer database, and instead opens the target document in the target database.
Sample code:
Sub Queryopendocument(Source As Notesuiview, Continue As Variant)
Let Continue = False ' to prevent the document in the pointer database from opening
Dim ws As New NotesUIWorkspace
Dim s As New notessession
Dim dbTarget As NotesDatabase
Dim dcSelected As NotesDocumentCollection
Dim docPointer As NotesDocument
Dim docTarget As NotesDocument
Dim astrTarget(2) As String
Set dcSelected = Source.Documents
Set docPointer = dcSelected.GetFirstDocument()
'find out where the target document resides
Let astrTarget(0) = docPointer.GetItemValue("DocTarget")(0)
Let astrTarget(1) = docPointer.GetItemValue("DocTarget")(1)
Let astrTarget(2) = docPointer.GetItemValue("DocTarget")(2)
'get the target document
Set dbTarget = s.GetDatabase(astrTarget(0), astrTarget(1), False)
Set docTarget = dbTarget.GetDocumentByUNID(astrTarget(2))
'the newinstance parameter is ignored, new tab is opened even if target document is already open in UI
Call ws.EditDocument(False, docTarget , False, , False)
End Sub
The problem is that the False value for [newInstance] parameter is ignored in
Set notesUIDocument = notesUIWorkspace.EditDocument( [editMode] , [notesDocument] , [notesDocumentReadOnly] , [documentAnchor$] , [returnNotesUIDocument] , [newInstance] )
and a new instance of the same document is opened in the UI. The newInstance = False should recognize that the document is already opened in the UI. This works when opening the same document multiple times from within the same database but not if the document is opened from a different database.
>>>>>>>Expectation
According to the help documentation of notesUIWorkspace.EditDocument method:
https://help.hcltechsw.com/dom_designer/12.0.2/basic/H_EDITDOCUMENT_METHOD.html
newInstance
Boolean. Optional. If True (default), opens a new instance of notesDocument (2nd parameter) in the UI. If False,
"changes focus to an existing instance of notesDocument if one exists", or to a new instance if one does not exist. This parameter does not apply if notesDocument is not specified or the document has a target frame.
In the setup databases, when clicking the same pointer document multiple times it opens a new instance of the document even though an instance of that document (same database and document) is already open in the UI, another instance of that document is opened.
This was tagged as known issue via SPR# JJARCYAMEE, however as per decision of Product Development, it is an enhancement request.