< Back

Document Subject: Open Parent Document From Response
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#OpenParent or http://A555F9/nn.nsf/ByAlias/OpenParent

When opening a response document from a doclink, commands such as @command(ShowHideParentPreview]); do not work. This is a solution.




Create a view in the database called vByDocUnid which has all documents in it

and a first sorted  column with the formula:  

@text(@documentuniqueid)

Create an action button on the response document that has the code:

REM "From http://www.notesninjas.com/#OpenParent";
@Command([FileOpenDatabase]; @DbName; "vByDocUnid" @Text($Ref) ;0;0);
@PostedCommand([EditDocument];"0");
@PostedCommand([FileOpenDatabase]; @DbName; "vByDocUnid" @Text($Ref) ;0;0);
@PostedCommand([FileCloseWindow])

 The action button should be hidden if  @isnewdoc

NB $Ref is the same as @InheritedDocumentUniqueID and

the lotusscript notesdocument.parentdocumentunid .

 

Alternatively try the lotusscript version which does not require a view to be created:

 Dim uiw As New notesuiworkspace
Dim db As notesdatabase
Set db = uiw.CurrentDatabase.database

Dim uidoc As notesuidocument
Set uidoc=uiw.currentdocument

Dim pdoc As notesdocument
Set pdoc= db.getdocumentbyunid(uidoc.Document.parentdocumentunid)
Call uiw.editdocument(False, pdoc)