Here's my set-up:
In my XPage, I have an embedded view which opens a document in the adjacent Panel.
Clicking the doc link in the view sets the doc's UNID in a viewScope variable, and refreshes the Panel. The UNID variable is used to define the Page's Data Source Document (doc
).
Now in a Button, I want to get a handle to the next document in the view, but when the following SSJS code is run an error occurs at the last line:
var v:NotesView = database.getView("ViewByYear");
var curDoc:NotesDocument = doc.getDocument();
// curDoc = v.getFirstDocument(); /* if this line is uncommented the error does not occur */
if (curDoc==null) return(false);
var nextDoc = v.getNextDocument(curDoc);
The error message is: Script interpreter error, line=11, col=32: [TypeError] Exception occurred calling method NotesView.getNextDocument(lotus.domino.local.Document) null
if I uncomment the commented line (setting curDoc as the first document in the view), the error does not occur.
Any idea why this is happening? How is the document generated from the Data Source different? This document comes anyway from this same view which is embedded on the same XPage.
Thanks for your insights