$object.canDelete()
canDelete($object)
Checks whether the currently logged-in user is allowed to delete the given object and returns a boolean.
The function never fails and never filters; it lets a script check delete access up front instead of running into the permission error that delete would raise for a non-deletable object.
The check is evaluated for the currently logged-in user and follows the same rules as the implicit permission enforcement: deny-by-default, role inheritance along the security hierarchy, and full access for administrators or executions in a system context.
| Name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
| object | Business object | The object whose delete access is checked. | yes |
Type: Boolean
true if the current user may delete the object, false otherwise (in particular for null).
if($obsolete.canDelete(), $obsolete.delete(), null)
Output: Deletes the object only if the logged-in user is allowed to – otherwise nothing happens, without a permission error.