@DocLock (Formula Language)

Locks, unlocks, returns the locked status of the current document, or indicates if a database has document locking enabled.

Note: This @function is new with Release 6.

Syntax

@DocLock ( [ options ] )

Parameters

[ options ]

Keyword. Choose one of the following actions:

[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.

Usage

The current document has to have been saved previously for this function to work properly. The document must be in Read mode when this function is triggered. Additionally, document locking must be enabled for the database or you will get the error, "Attempted a lock operation on a DB that doesn't support locking" when you try to use the [LOCK], [STATUS], or [UNLOCK] keywords.

To enable document locking:

  1. Specify a Domino® server as the Administration Server (Master Lock Server) on the Advanced panel of the Access Control List dialog box for the database.
  2. Select the Allow Document Locking check box on the Database Basics tab of the Database Properties box.

You cannot use this function in Web applications.

Examples

If a user wants to lock a document opened in edit mode, the following four hotspot buttons entitled LockingEnabled, Status, Lock, and Unlock will enable her to do so.

First, to determine if the current document can be locked, the user checks if document locking is enabled for the database. When the user clicks the LockingEnabled button, which contains the following code, it returns 1 to indicate that locking is enabled.

@Prompt([OK];"Checking if document locking is enabled";@DocLock([LOCKINGENABLED]))

If locking is enabled, the user next clicks the Status button, which contains the following code. If it returns an empty message box, the current document is not locked.

@Prompt([OK];"Checking document status";@DocLock([STATUS]))

Once the user clicks the Lock hotspot button which contains the following code, the administrative server locks the document. If the user clicks the Status button again, a message box appears that displays the current user's hierarchical name.

@DocLock([LOCK])

If the user then clicks the Unlock hotspot button that contains the following code, the administrative server unlocks the document. When the user clicks the Status button again, an empty message box appears.

@DocLock([UNLOCK])