In my Notes database, I audit when I save a document. Pretty easy in LotusScript. I take the source document (oDoc) from the server, and then in the document I modified (mDoc), I make a Forall loop that gets the names of each element; forall item in mDoc.items. Take the same element from oDoc, execute a function with the new element as an argument that will work with the case argument, which will see if this field is of interest. if so, I am updating the set of list values in the document with When, Who, Which Field, and New Value.
I am doing this server side script. After trying this, I found a couple of interesting things:
currentDocument is a NotesXSPDocument document containing everything that has just been modified.
currentDocument.getDocument () contains pre-replacement values. It also returns a NotesDocument in which there is a “items” field that I can execute.
The thing is, I need something like this in NotesXSPDocument. Is there a way in an iterative loop to grab the names and values of all elements from there?
Here is the broken code. (He is currently looking at NotesDocument elements, but these are old values. I would rather go on to elements of an XSP document)
function FInvoice_beginAudit() {
var original_doc:NotesDocument = currentDocument.getDocument();
var oItem:NotesItem;
var oItems:java.util.Vector = original_doc.getItems();
var iterator = oItems.iterator();
while (iterator.hasNext()) {
var oItem:NotesItem = iterator.next();
item = currentDocument.getItemValue(oItem.getName());
if (oItem == undefined) {
var MasterItem = ScreenAudit(doc,item,True)
if (MasterItem) { return true }
} else {
if (item.getValueString() != oItem.getValueString()) {
var MasterItem = ScreenAudit(doc,Item,True);
if (MasterItem) { return true }
}
}
}
}
source
share