GetDocumentByUNID

Hi all,

I have a form action that is supposed to open the parent document. It works all fine when opening from a response document but when opening from a response to response document the response open. I want the root document to open at all times not the responses.

Here is my code:

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim uiRfadoc As NotesUIDocument

Dim rfaDoc As NotesDocument

Dim parentDoc As NotesDocument

Dim ws As New NotesUIWorkspace

Set uiRfaDoc = ws.CurrentDocument

Set rfaDoc = uiRfaDoc.Document

Set db = session.CurrentDatabase

Set parentDoc = db.GetDocumentByUNID(rfaDoc.ParentDocumentUNID)

Call ws.EditDocument(False,parentDoc)

End Sub

Subject: GetDocumentByUNID

You could add:

While parentDoc.ParentDocumentUNID <> “”

Set parentDoc = db.GetDocumentByUNID(parentDoc.ParentDocumentUNID)

Wend

After the line:

Set parentDoc = db.GetDocumentByUNID(rfaDoc.ParentDocumentUNID)

This moves up the tree until the top parent is found.

Subject: Works perfect, Thank you