I’m sure you also need sort of “profile documents” once in a while. Documents where a user can store some values he wants to use over and over again, in Web technology term thing of a “cookie”.
This is plain easy!
Simply open the xPage and as a Data source document id (red box) define a computed value like this:
Document ID code:
var doc:NotesDocument = database.getView(“lupUserProfiles”).getDocumentByKey(session.getEffectiveUserName(), true);
if( null != doc ){
return doc.getUniversalID();
}
that way the xPage will either be displayed empty (when no such “profile” document exists) or it will use the appropriate user profile it finds.
In the QuerySave (or somewhere else) you need to make sure to save the user name and have it in the view as sorted first column of course
QuerySave code:
try{
var doc:NotesDocument = docCurrent.getDocument();
var item:NotesItem = doc.replaceItemValue(“userName”, session.getEffectiveUserName())
item.setAuthors(true);
}catch(e){
// handle error
}