Solved

Locking system : doc stays locked after user closed document

Posted on 2006-07-17
29
976 Views
Last Modified: 2013-12-18
Hi,
I have designed a DB with locking system enabled. Some times the lock on a document stays even when the user closes the doc. Is it a bug?

Thanks in advance for your help,
Koray.
0
Comment
Question by:koray_uygun
  • 9
  • 9
  • 6
  • +1
29 Comments
 

Author Comment

by:koray_uygun
ID: 17121975
How can I solve this? What should I do?
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17122344
What version of Client and Server ?

Is the server very slow ?

Please provide more information, including the code you are using to lock and unlock the docuemnt.

I hope this helps !

0
 

Author Comment

by:koray_uygun
ID: 17122375
Client is 6.5.3, server is 6.5.5. The server is sometimes slow. I don't use any code to lock or unlock it.

Thanks for considering my problem.
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17122764
In the R 6.5 Designer type in
Lock into the help.

Here is what it says in the example

Example
Locks a document.
Note  This method is new with Release 6.5.
Defined in
Document
Syntax
public boolean lock()
    throws NotesException
public boolean lock(String name)
    throws NotesException
public boolean lock(String name, boolean provisionalok)
    throws NotesException
public boolean lock(java.util.Vector names)
    throws NotesException
public boolean lock(java.util.Vector names, boolean provisionalok)
    throws NotesException
Parameters
String name
java.util.Vector names
The names of the lock holders. Each lock holder must be a user or group. Defaults to one lock holder: the effective user. The empty string ("") is not permitted.
boolean provisionalok
true to permit the placement of a provisional lock
false (default) to not permit a provisional lock
Return value
boolean
true if the lock is placed
false if the lock is not placed
Usage
IsDocumentLockingEnabled in Database must be true or this method throws an exception.
This method:
places a persistent lock if the administration (master lock) server is available.
places a provisional lock if the administration server is not available and the second parameter is true.
throws an exception if the administration server is not available and the second parameter is false.
The following actions occur depending on the current lock status:
If the document is not locked, this method places the lock and returns true.
If the document is locked and the current user is one of the lock holders, this method returns true.
If the document is locked and the current user is not one of the lock holders, this method returns false.
If the document is modified by another user before the lock can be placed, this method throws an exception.
Language cross-reference
Lock method in LotusScript NotesDocument class
@DocLock function in formula language
Example
See Also
Locking documents and design elements

------------------

I hope this helps !
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17122783
For Lotus script see
This view action attempts to lock the current document for all members of the "Guys" group. Locking is successful if the document is not yet locked, or the document is locked but the effective user is a member of Guys. A provisional lock is allowed if the administration server is not available.
%INCLUDE "lsxbeerr.lss"

Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
 
  REM Exit if locking is not enabled
  If Not db.IsDocumentLockingEnabled Then
    Print "Document locking not enabled"
    Exit Sub
  End If
 
  REM Get selected document
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
 
  REM Lock the document
  REM Not locked if return is False or error is raised
  On Error Goto errh
  If doc.Lock("Guys", True) Then
    Print "Document locked"
  Else
    Print "Document NOT locked"
  End If
  Exit Sub
errh:
  If Err() = lsERR_NOTES_LOCKED Then
    Print "Document NOT locked"
  Else
    Messagebox "Error " & Err() & ": " & Error(),, "Error"
  End If
  Exit Sub
End Sub
See Also
Lock method
0
 

Author Comment

by:koray_uygun
ID: 17122801
It is supposed to work without coding isn't it?
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 63 total points
ID: 17126428
From the Designer Help database:

When you set the database property "Allow document locking," users with Author access or higher can lock documents in that database. Locking a document prevents editing and replication conflicts by ensuring that person who locks the document has exclusive rights to modify the document; others with the same rights cannot modify a locked document even if they are working on a different replica on the same LAN. Managers of a database cannot edit a locked document. However, managers can unlock documents that are locked.

So, no, it is not a bug. If you are Manager of the database, you can unlock the document.
0
 
LVL 18

Assisted Solution

by:marilyng
marilyng earned 62 total points
ID: 17127196
In a database where locking is enabled, then the document is automatically locked when it is saved.  The person who locked it is found in the $writers field, and the time it was locked is in the $writersDate field.

Select the document in the view, right click and from the right-click menu select "Unlock the document"  If you have correct access, or are the person listed in the $Writers field, you can unlock the document, and both the $writers field and $WritersDate fields will be deleted from the document.

If you select "lock the document" when it is already locked, you will get a message, "The document is already locked."

Obviously, the author rules come into play here.  The person who locks the document has "last edit rights" and only he or she can lift the lock, unless, as sjef says, you are the database manager.
0
 

Author Comment

by:koray_uygun
ID: 17128207
Hi all,
Sjef, I have understood what you said but as I said at the beginning, the closed documents are locked. What I understood of this feature is that a doc is locked when edited then automatically unlocked when closed.
Marilynq, the document is locked when saved or when edited? Does it stay locked even when it is closed? Do we have to unlock it by code?

Thanks to you all.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17128298
As Marylin says,
>  the document is automatically locked when it is saved
so the user who locked it (automatuically) should unlock the document.

From the Help database:
"To unlock a document you have locked, you must use the same User ID you used when you locked the document.
  1.    Select the document you want to unlock.
  2.    Do one of the following:
Choose Actions - Unlock Document to manually unlock a document
Close the document if you opened or placed it in Edit mode to set a temporary lock.
Tip  The status bar says "Document successfully unlocked" when you unlock a document."

Locking can be programmed in the Save-button if you have one. See the @DocLock function.

@DocLock ( [ options ] )
[LOCK] Locks the current document.
[UNLOCK] Unlocks the current document.
[STATUS] Indicates the locked status of the current document. Returns null if the document is not locked or a textlist of the users who have locked the document if it is locked.
[LOCKINGENABLED] Indicates if the current database has document locking enabled. Returns 1 (@True) if locking is enabled and 0 if it is not.
0
 

Author Comment

by:koray_uygun
ID: 17128399
What is a temporary lock? May be it is the one I use. If I had to unlock the each doc (by code at queryclose), all the docs should have been locked. But I have only some documents locked.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17128513
The more I read the Help, the more I doubt the statement "the document is automatically locked when it is saved".

It seems to me that document locking is primarily a user action if you didn't use any locking in your application. The user who locked the document is in the $Writers-field of the document. Ask that person what (s)he did on $WritersDate.
0
 

Author Comment

by:koray_uygun
ID: 17129597
Ok, I have just made a test. As I taught, when I edit a doc, the $Writers and $WritersDate fields are filled with my name and the present date. Then, when I close the doc, these fields are removed. All of this without code. This is the normal behaviour for me but my original question is that this automatic unlocking when closing an edited doc sometimes does not work properly and the doc remains locked.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 18

Expert Comment

by:marilyng
ID: 17132220
sjef.. I tested my statement before I posted.  Several times because I didn't believe it the first time.  The document locked itself automatically when I saved it.  Maybe it was my setup or my quick test scenario, but when i went to manually lock it, I got the "Document is already locked.." No one was more surprised than me.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17132244
The difference might be in the administration server value in the ACL of the database and if this replica is sitting on the administration server.   I tested on the Administration server, with the Administration server set in the ACL.  If the ACL is not set, then the document might not automatically lock.   If the replica is not sitting on the administration server, it depends on replication to lock it.  I think.....?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17134311
I just tested the following:
- existing doc, open for Edit, check properties in view: Locked; saved, closed -> Not locked
- new doc, saved, closed -> Not locked!

ACL not set? Then you can't enable document locking in the database.

Tested on R7.0.1 by the way...

0
 
LVL 18

Expert Comment

by:marilyng
ID: 17135217
Well, I'm still on 6.5.3 - I wasn't expecting it to be locked, either.  In 6.5.3 you can enable, but you get the message that the ACL needs to have an administration server.   Very odd..

Yeah, Yeah, rub it in that you're on 7.0.1
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17136419
Nod odd. The message in the ACL is the same. You THINK you enabled it, a tick is displayed, but I noticed that when you open the properties again, it isn't enabled at all. So without an Admin server, no locking.
0
 

Author Comment

by:koray_uygun
ID: 17136519
The lock admin server in the ACL is manager so the problem isn't there...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17136545
Did you check some of the locked documents? And ask the users what they or how they did it did?
0
 

Author Comment

by:koray_uygun
ID: 17137381
I will as soon as I see a locked doc, unfortunately I had to unlock the docs manually to solve the pb.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17137427
Perhaps add a view that collects on @isAvailable($Writers) and x days old, and then use an automated agent to unlock them.  I would probably do this, anyway.  Whenever I had to lock documents the old way, I had a view and an agent that would unlock them after they were a day old.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17137433
Ah, what a pity... But if you say that a doc stays locked after closing the document, you should be able to reproduce a locked document easily. True??

There are no calls to @DocLock or NotesDocument.Lock in your application?
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17137550
I think koray said there was no coding other than configuring locking on the server and using it manually.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17137596
I know, I know, just checking... Being careful...
0
 

Author Comment

by:koray_uygun
ID: 17138914
Yes, marilynq, there is no code...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17139928
I suppose that, when Notes crashes while a document is locked, the document stays locked. I hope you don't have that many crashes...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now