Solution Offered: Soft Document Locking Problem Workaround

I have recently had to deal with the frustration of Soft Document Locking on an application I was building which was causing fits for the way it was being designed (and for other legacy applications to be upgraded to ND6).

My scenario was that I was using a document link in the “About” document for the database launch. This document needed to be opened in edit mode because of how I was designing the Navigation in conjunction with Tabbed Tables. Of course once one person opened the document, the document was locked by the soft locking mechanism bult into ND6 (document locking was not enabled on the database).

As this was a non-starter for what I was trying to accomplish, here is how I did a workaround (I could not find one searching here), and would appreciate other people’s thoughts, comments and feedback):

  1. Set the database properties to allow document locking.

  2. In the PostOpen event (for documents opening by default in Edit Mode) or the PostModeChange Event (for documents to be manually be put into Edit mode), put the following code:

Sub Postopen(Source As Notesuidocument)

Dim doc As NotesDocument

Set doc=source.document

Call doc.RemoveItem( “$Writers” )

Call doc.RemoveItem( “$WritersDate” )

Call doc.Save( True, True )

End sub

NOTE: The following will NOT work:

Sub Postopen(Source As Notesuidocument)

Dim doc As NotesDocument

Set doc=source.document

Call doc.UnLock

Call doc.Save( True, True )

End Sub

So far this has worked like a charm FOR MY SCENARIO and peopbably would not be the best approach for other purposes, such as “real documents” in a workflow. But this does look like it will save me much agony and many headaches. I will keep testing and post again if I find there are problems.


Christopher Byrne, IBM CAAD/CASA

The Cayuga Group, LLC

http://www.thecayugagroup.com/

Subject: New Technote: Soft Document Locking Problem with mail files

Hi

IBM have posted a new Technote regarding the soft document locking problem with mail files -Draft or Stationery,

Details as under TN: 1100606 dated 12/15/2003.

Here is the link

http://www-1.ibm.com/support/docview.wss?rs=0&q1=1100606&uid=swg21100606&loc=en_US&cs=utf-8&cc=us&lang=en

Rm