getParentDocument (NotesView - JavaScript)

Given a response document in a view, returns its parent document.

Defined in

NotesView

Syntax

getParentDocument(doc:NotesDocument) : NotesDocument
Parameter Description
doc Any document in the view. Cannot be null.
Return value Description
NotesDocument The parent of the parameter (the document to which the parameter is a response). If you have filtered the view using FTSearch, this method returns the previous document in the view, regardless of level. Returns null for a main document.

Usage

The document returned by this method may be a main document, a response, or a response-to-response.

Examples

This button gets all the top-level documents in a view in reverse order.
var v:NotesView = database.getView("main");
var doc:NotesDocument = v.getLastDocument();
while (doc.isResponse()) {
	doc = v.getParentDocument(doc);
}
while (doc != null) {
	requestScope.status += "\n" + doc.getItemValueString("subject");
	tmpdoc = v.getPrevSibling(doc);
	doc.recycle();
	doc = tmpdoc;
}