Hi guys,
Hoping someone has an answer to this problem:
scenario: I built my own locking system that allows only a single person to edit a document. I do this by placing a field called hasEditor in the form which contains the name of the user editing the document. When a user opens the document and the hasEditor field already contains a name, i just give that user read access, no edit, until the user editing the document releases or closes the document. Up to that point, i have no problem, everything works.
But this is where my problem starts, here’s the code:
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
If Not(uidoc.IsNewDoc) Then
If uidoc.EditMode Then
Dim db As NotesDatabase
Set db=ses.CurrentDatabase
Dim tdoc As NotesDocument
Set tdoc=db.GetDocumentByUNID(doc.UniversalID)
tdoc.hasEditor=""
Call tdoc.Save(True,False)
End If
End If
End Sub
the objective of this code is that when user the user exits/closes the form, hasEditor filled is set to “”. Supposedly this code should work even if the user made changes to the form and did not save it. Unfortunately, it saves the changes of the user in the form even if the user chose not to save it in the saveOptions dialogue box. That is why i did not get the value of tdoc using uidoc.document but i used GetDocumentByUNID to get it. Because i know with this operation, I can get the back-end document and change only the hasEditor field, even if the user made changes on the form and its changes are not reflected in the back-end. Unfortunately this does not work. The only thing i want is to get the back-end without the changes.
Thanks in advance.