# Hook on changed custom field

**URL:** https://meta.discourse.org/t/hook-on-changed-custom-field/305287
**Category:** Development
**Created:** [April 24, 2024, 4:55pm UTC](https://meta.discourse.org/t/hook-on-changed-custom-field/305287 "2024-04-24T16:55:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 24, 2024, 4:55pm UTC](https://meta.discourse.org/t/hook-on-changed-custom-field/305287/1 "2024-04-24T16:55:16Z")

</div>

In a plugin I want to run some code when a specific topic custom field changes. However, it seems that `add_model_callback` does not work because the [code](https://github.com/discourse/discourse/blob/be96295c256f15d705ffe3ea81e0de0c6f79ead6/app/models/concerns/has_custom_fields.rb#L338-L34) bypasses ActiveRecord and writes to the database directly.

Does anyone know the best way to accomplish this?
