Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Open Parent Document From Response

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#OpenParent or http://www.notesninjas.com/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)

 


 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Lotus Notes 5 All-in-one Certification Exam Guide by Libby Schwarz, Ben Malekzadeh
Sort out your CLP with this book.
See at: Amazon.co.uk | Amazon.com |