This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entity.unlock( )
|
entity.unlock () -> Result | ||||||||
Parameter | Type | Description | ||||||
Result | Object |
![]() |
Status object | |||||
The entity.unlock( ) method removes the pessimistic lock(*) on the record matching the entity in the datastore and table related to its dataclass.
(*)For more information, please refer to the Entity locking page.
A record is automatically unlocked when it is no longer referenced by any entities in the locking process (for example: if the lock is put only on one local reference of an entity, the entity and thus the record is unlocked when the process ends).
Note: When a record is locked, it must be unlocked from the locking process and on the entity reference which put the lock. For example:
$e1:=ds.Emp.all()[0]
$e2:=ds.Emp.all()[0]
$res:=$e1.lock() //$res.success=true
$res:=$e2.unlock() //$res.success=false
$res:=$e1.unlock() //$res.success=true
Result
The object returned by entity.unlock( ) contains the following property:
Property | Type | Description |
success | boolean | True if the unlock action is successful, False otherwise. If the unlock is done on a dropped entity, on a non locked record, or on a record locked by another process or entity, success is False. |
C_OBJECT($employee;$status)
$employee:=ds.Employee.get(725)
$status:=$employee.lock()
... //processing
$status:=$employee.unlock()
If($status.success)
ALERT("The entity is now unlocked")
End if
Product: 4D
Theme: ORDA - Entity
Created: 4D v17
4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)