javascript - Get all items in NotesXSPDocument -
In my notes database, I audit when the document is saved. Lotuscript is very easy, I take the original document from the server (oDOK), then in the document that I have modified (MDOC), I loop a follower who receives the names of each item; Hold the same item from the ODoc for all items in the MDoc.items, execute a function with new items as an argument that will run a case statement that will see if there is an area in which we Care about If so, then I update a set of list values in the document with "when", "who", "what field" and "new value".
I'm doing this on server side script. In this endeavor, I discovered some interesting things;
The current documents are notes-SSP documents, in which everything was changed.
currentDocument.getDocument () includes pre-conversion values, it also gives a notes document that contains the "item" field through which I can run.
The thing is, I need something similar in the notes p.pdicast. Is there no way in the repeated loop to get the names and values of all the objects from there?
There is a broken code (currently this note is running through the document item, but these are old values. I want to run on XSP document items instead)
< Code> function phenowice edit () {var original document: notes document = current document.jet document (); Var oItem: Notes; Var oItems: java.util.Vector = original_doc.getItems (); Var easter = oItems.iterator (); While (iterator.hasNext ()) {var oItem: NotesItem = iterator.next (); Item = currentDocument.getItemValue (oItem.getName ()); If (oItem == undefined) {var MasterItem = ScreenAudit (doc, item, is true) if (MasterItem) {true return}} else {if (item.getValueString ()! = OItem.getValueString ()) {var MasterItem = ScreenAudit (doc, item, this is true); If (MasterItem) {return true}}}}
both versions
you receive After submitting a document - original and one with it:
Basic: var Basic documents: Notes document = current document. Tags ();
changed: var changed_doc: notesDocument = currentDocument.getDocument (true);
In this way you can compare objects for changes
However, there is a danger: currentDocument.getDocument (correct)
"Original_doc" after telling "changed_doc" for the reason that both variables move to the same document are also converted values. This is the reason why we get all the values from currentDocument.getDocument ()
into a new temporary document and only after converting values with currentDocument.getDocument (true)
Must have to copy. As an alternative, you can read the basic documents from the server like what you do in LotusScript
This is a code to detect items that have changed as a starting point.
at original_doc: notesDocument = database.createDocument (); CurrentDocument.getDocument (). CopyAllItems (original_doc, true); Var changed_doc: notesDocument = currentDocument.getDocument (true); Var oItems: java.util.Vector = original_doc.getItems (); Var easter = oItems.iterator (); While (iterator.hasNext ()) {var oItem: NotesItem = iterator.next (); Var itemName = oItem.getName (); Var cItem: NotesItem = changed_doc.getFirstItem (itemName); If (cItem.getText ()! == oItem.getText ()) {print ("changed:" + itemName); } OItem.recycle (); CItem.recycle (); } Original_doc.remove (true); Original_doc.recycle ();
Comments
Post a Comment