If I create a document in the backend and then edit it then the IsNewDoc property of a uidoc indicates false (fair enough, kind of) because the front end see’s this as an old document.
So I use IsNewNote. Works fine except when the user clicks on a button which does a @Command([FileSave]), the document saves and IsNewNote still thinks it is a new document.
Why??? Any suggestions??? I’d rather not have to use fields to tell me if a document is new or not.
tanx muchly.
Subject: IsNewNote & IsNewDoc
I’ve never run into that – IsNewNote has always been reliably false for me after a save. Can you elaborate?
Subject: RE: IsNewNote & IsNewDoc
Ok for example,
create a new form. Put an editable field in it. Now create 2 action buttons, in the first put @Command([FileSave])and call it “Save”. In the second put the following in the script and call the button “Display”:
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
If doc.IsNewNote Then
Messagebox( "New Note")
Else
Messagebox( "Saved")
End If
Now test the document. Click the Display button and you will get a mesagebox with New Note. Now click the save button and then click the display button. I still get New Note.
Hope this explains better.
Subject: ANSWER – IsNewNote & IsNewDoc
The copy of the doc that you have in memory is different from the one on disk. The @Command effects the UIDoc but not the Doc.
In other words, there is 1) the actual document stored on disk, 2) the UIDoc in memory, and 3) the Doc in memory. You can update fields in the Doc or UIDoc without effecting the actual doc (then you can choose to save or not save either). Also, the actual doc can be updated (by you or by someone else) while the UIDoc and Doc will not reflect the changes on disk. The latter is your situation.
Subject: RE: ANSWER – IsNewNote & IsNewDoc
Ok, saying that though, the @Command([FileSave]) saves the UIDOC. But when you run the other action you are inialising the backend doc again by assign it to the uidoc:
ie set doc = uidoc.Document.
So shouldn’t that set the doc to the uidoc. Or are you saying that Notes goes to the actual document on disk to get this information???
Ta
Subject: RE: ANSWER – IsNewNote & IsNewDoc
Well … Seeing that snippet of your code makes me think that it should work. Since you got a new handle on Doc from UIDoc (which is no longer new), it seems that should make Doc not new as well. Hmmm… What if you check to see if it has a UNID? You cannot get a UNID until it has been saved.
???