Locking (new)
Last updated
Last updated
Let’s say we have two users, A (left) and B (right), which load the same item in Artikelstamm. Both of them will see a closed lock:
User A makes an edit on the suchwort. His lock is “opened” and user B gets an instant notification that the record is locked:
User B can attempt to make changes such as edit text fields, press Save, Delete, etc., but will get an error message and the pending edit reverted:
When hovering over the red lock, you can also find out who is currently locking the record:
When user A saves the record, user B gets a notification that his record has just been refreshed with the latest information:
The user currently locking the record can click on the lock menu item to release the lock, thus allowing another user to edit the record:
If the record is not yet locked, the user can explicitly lock the record without performing any edit by clicking on the lock:
When the user currently locking loads another record or closes the module, the lock is automatically released and other users viewing the information will have their lock status updated:
Make sure that the main DataSet has locking activated for the main table:
Set the “LockOnRetrieve” property to true in the BusinessObject (formerly named “AutoLock”), to make sure the record is automatically blocked on retrieve when the BusinessObject is used programmatically:
Wrap the BusinessObject retrieve function in a DataRetrieveTransition method call:
Set the “UseInteractiveLocking” property on the WHO for all constructors:
Override OnReload to correctly handle the refresh when the current record is changed by another user:
Mark controls that shouldn’t trigger locking by setting the “PreventLock” property to true:
The first 3 steps from the 6 presented above were part of the “legacy locking” requirements, only the last 3 steps were added for this new functionality.
The following WHO events trigger the lock function:
MenuItemClicked
ButtonClicked
ItemChanging
From any point in the code, if locking is needed (such as if an event is triggered that is not one of the 3 highlighted above), locking can be requested by calling the “Lock” method explicitly on the WHO.