Welcome to the IBM Collaboration Solutions Community IQJam.
UsernamePassword
Reset Password | Register
   
Home | Leader Board | Tags | Help
In what context can I use currentDocument.getParentId() ? 
I want to show data from a parent document alongside the data on a response document. I am trying to use currentDocument.getParentId() as the hook back to the parent from the response.
 
When I use currentDocument.getParentId() at the time of creating the response document it has a value but when I open the response document later it has no value. The document is definitely a response and I get the same behaiour in a copy of the "new discussion" template.
 
IBM help
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.api.doc/r_wpdr_xsp_xspdocument_getparentid_r.html
 
I could store the value in a field but I thought that this would be neater. 
 
Thanks, Sean
Domino Development / XPages
Tagged
SSJS 
Sean Cull - about 1 year ago |  |  | Viewed 317 times

There are 2 answers

0votes
Hi Sean,
 
A couple of questions. 
  1. Is the document you're working with really a response document? (i.e. has it got the $Ref field)
  2. If it has is the value correct?
  3. If it isn't a response then that will be the reason it doesn't work. You may need to set the Form design to make sure that documents created using it are responses.
As a general rule I am switching away from using response documents in XPages. The overhead of looking up values using views is low enough that I prefer the flexibility of having everything as a "normal" document that just has references stored on it by me if I want some pseudo relational behaviour in my XPages.
 
Matt 


Matt White - about 1 year ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community


1votes
I use and like response documents because I like NotesDocument.getResponses() rather than rely on yet another view.
 
To answer your need: I think you'll need to instead use currentDocument.getDocument().getParentDocumentUNID()
 
currentDocument isn't a NotesDocument object, it's a NotesXspDocument object which is an xpages-specific wrapper around the NotesDocument.  I don't know what currentDocument.getParentId() returns but I expect it refers to either the collection of NotesXSPDocument objects used on the page or whatever is above it in the XPages object model.


John Smart - about 1 year ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community