Open parent instead of response from view

I have a view of parent and response docs in hierarchy, what I am trying to achieve is if the user double clicks a response doc, the parent doc is opened instead(the parent has an embedded view of responses).

I have tried using some LS in the Queryopendocument to switch the docs but when the parent doc goes to open it triggers the Queryopendocument event again and I end up stuck in some kind of loop which results in a “Script Stack Overflow” error.

Here is my code:

Dim s As New Notessession

Dim ws As New NotesUIWorkspace

Dim dc As NotesDocumentCollection

Dim db As NotesDatabase	

Dim doc As NotesDocument

Dim mainDoc As NotesDocument



Set db = s.currentDatabase

Set dc = Source.Documents

Set doc = dc.GetFirstDocument



If doc Is Nothing Then

	Exit Sub

Elseif doc.IsResponse Then

	Call source.DeselectAll

	Set mainDoc = db.GetDocumentByUNID(doc.ServReqUNID(0))

	Set doc = Nothing

	Call ws.EditDocument(mainDoc)

End If

I’m trying to avoid putting the code into the Queryopen event of the form as I still want to be able to open the response doc outside of this view.

Has anyone accomplished this before or know how to?

Cheers…

Subject: Open parent instead of response from view

You could test the current document (ws.CurrentDocument.Document) to be IsRepsonse and when true exit this event immediately.

Subject: Open parent instead of response from view

I’ve done this before. I set a form formula in the view so it uses an alternate form for the response documents. The Postopen event for the alternate form then opens the parent document and closes the child.

Subject: RE: Open parent instead of response from view

Cheers - that works well.

Subject: RE: Open parent instead of response from view

A few years passed since you posted but it’s still useful, thank you !