The second XSnippet I have added to the XSnippet Contest is a help to fire the querySave– and postSave-events from SSJS: Save Datasource & Fire querySave/postSave events
If you only do a simple document1.save() , the events of a datasource won’t be executed. To fix this, you have to use the save() method of com.ibm.xsp.model.domino.DominoDocumentData instead:
var dsName = "document1.DATASOURCE"; // change this to the name of // the datasource you want // to save var app = facesContext.getApplication(); var ds = app.getVariableResolver() .resolveVariable(facesContext, dsName); ds.save( facesContext, true);
The variable dsName contains the name of the datasource to save, followed by „.DATASOURCE„. To use it f.e. with the current document, you have to change the variable to „currentDocument.DATASOURCE„.
The difference here is the type of object that is used: If you save a document datasource, the save method of an object of type NotesXspDocument is called. The com.ibm.xsp.model.domino.DominoDocumentData object has another method for saving. The first object type is like a backend NotesDocument, the second object is like the NotesUIDocument class.