Server side events or Python side events

Controller Hooks

To add custom behaviour during the lifecycle of a document, we have controller hooks.

Method Name Description
before_naming This is called before the name property of the document is set.
autoname This is an optional method which is called only when it is defined in the controller at document creation. Use this method to customize how the name property of the document is set.
validate Use this method to throw any validation errors and prevent the document from saving.
before_save This method is called before the document is saved.
on_change This is called to indicate that a document’s values has been changed.
on_update This is called when values of an existing document is updated.
before_insert This is called before a document is inserted into the database.
after_insert This is called after the document is inserted into the database.
before_submit Called before a document is submitted.
on_submit This is called when a document is submitted.
before_update_after_submit This is called before a submitted document values are updated.
on_update_after_submit This is called when a submitted document values are updated.
before_cancel This is called before a submitted document is cancelled.
on_cancel This is called when a submitted is cancelled.
before_rename This is called before a document is renamed.
after_rename This is called after a document is renamed.
on_trash This is called when a document is being deleted.
after_delete This is called after a document has been deleted.
5 Likes

before_naming saved me here.
Not a mention in the official doc.

1 Like