Hi
I recently posted questions on using Notes 6 native locking. After a lot of research, I found a useable way of using locking - I have posted the code below (default edit locks no good - see my earlier post).
However, to my horror, we got a replication/save conflict today. I am racking my brains as this should not be possible using the locking, unless I have missed something.
The weird thing is that the save conflict document has not ‘modified by’ field - it is blank.
Is this in some way a rewrite by the system itself when clearing the lock which might have caused this? I am having serious doubts about locking which will have very serious effects on our ability to use Notes for a fairly major workflo app.
Please - any advice much appreciated!!!
Tim
QueryOpen:
’
’ new documents don’t yet exist, so lock would fail
’ however, when the document is saved, it seems to be automatically locked by the save
’ process, so lock correctly configured once the document is first saved
’
If Not isnewdoc Then
On Error Goto islocked
locktest = source.Document.Lock
End If ’ if not isnewdoc then
Exit Sub
islocked:
Msgbox "Document locked by " + get_lock_name(source.document)
continue = False
Resume Next
QueryClose:
’
’ when creating a new document, even though source.document exists on the save
’ it seems to cause an error on the document.unlock, so we just skip over it
’
On Error Goto errhand
source.Document.UnLock
Exit Sub
errhand:
Resume Next
Function get_lock_name(lockdoc As notesdocument) As String
’
’ get the name of the person locking a document from the $Writers field
get_lock_name = “”
If Not lockdoc.HasItem(“$Writers”) Then
Exit Function
End If
Dim inm As New NotesName(lockdoc.GetItemValue (“$Writers”)(0))
get_lock_name = inm.common
If lockdoc.HasItem(“$WritersDate”) Then
get_lock_name = get_lock_name + " (" + Format(lockdoc.GetItemValue(“$WritersDate”)(0),“General Date”) + “)”
Exit Function
End If
End Function