Frappe Cloud Support Partners Foundation Frappe School

How do to execute code after update or after save?


I went through the frappe framework documents on Controller Hooks ( but I can’t seem to find an after_update or after_save hook. There is only an after_insert hook.

How do I execute a code after update of after save?

Does anyone have a sample code to achieve this?

Thank you very much

after_insert is what you’re searching for. This is called after the document is inserted into the database.

on_update also works.

  • Before the SQL UPDATE, the validate() function is called.
  • After the SQL UPDATE, the on_update() function is called.

Unfortunately, the Controller functions have very inconsistent naming.

So, whenever I have doubts, I always examine the base Document class. And read some of the comments that talk about the sequence of events.



Which method works same as after_save ?

You can use either after_insert or on_update. Both runs after saving.