in lotus notes 6.5.6 i have a document and inside this there is a "clone doc" button that create a copy of the uidoc and open it in workspace. My problem is that when the cloned document is opened in the workspace is already saved and i don't want this. i have already check in the "Queryopen", "Postopen"... states but there isn't a doc.save call. So, how can i open a new cloned doc in my workspace without saving it ? Here is my wrong code.
Dim session As New notessession
Dim uiw As New notesuiworkspace
Dim uidoc As notesuidocument
Dim db As NotesDatabase
Dim newdoc As NotesDocument
Dim NewUIDoc As NotesUIDocument
Dim doc As notesdocument
Set uidoc=uiw.currentdocument
Set db=session.currentdatabase
Set doc=uidoc.document
Set newdoc = db.CreateDocument
Call doc.CopyAllItems( newdoc)
Set NewUIDoc = uiw.EditDocument( True ,newdoc)
You -wrongly- assume, that the document is "saved", most probably because "@IsNewDoc" and NotesUiDocument.isNewDoc both return FALSE on any document that has been created in LotusScript prior to opening it with uiw.EditDocument.
This is a well known flaw in the design of Lotus Notes. You need your own function, to check if a document is new.
In Formula I usually use a computed for display field called "IsNewDoc" that contains the formula:
@Modified = @Created
For LotusScript I have an own function that looks like this:
Function MyIsNewDoc( doc As NotesDocument ) As Boolean
MyIsNewDoc = (doc.Lastmodified = 0)
End Function
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments