...thanks everyone, I tried these suggestions but it frustratingly doesn't seem to be that simple. It seems that if I qualify the datatype of the var, like so:
var NotesDocument:doc = database.getView('MyView').getDocumentByKey(unid);
It returns an empty document (i.e. the fields I'm expecting in 'doc' are empty) but doc is not null. However, this line:
var doc = database.getView('MyView').getDocumentByKey(unid);
...successfully returns the data I am expecting, but when I try to call:
doc.save(true,false);
...I get the exception: Exception occurred calling method NotesDocument.save(boolean, boolean)
Unfortunately that is all the details the logs offer.
Looking at the API a little closer I see that "getDocumentByKey" returns a "Document" object. The "Document" object (interface?) in turn DOES NOT have a method "save(boolean, boolean)" - it doesn't seem to have any "save" methods. This may be why when I make the variable of type "NotesDocument", the "save" method works - but the data goes away.
Questions:
- How do you change and re-save results from "View.getDocumentByKey()"? I know it's possible with LotusScript**, so it should be in server side javascript, non?
- I assume that writing "var NotesDocument:doc ..." is declaring a variable 'doc' or type 'NotesDocument', correct? WIll this automatically cast objects?
- Is it possible to create a "NotesDocument" from a "Document" object? Is "Document" a super class of "NotesDocument"?
Sincere thanks again for any help!
Alex
** - I am basing my javascript on working LotusScript from from a previous programmer (but am much more comfortable in javascript than LotusScript).