<p>You'd have to create a plugin but you could listen for the <strong>entries.saveEntry</strong> event that is noted here: <a href="http://buildwithcraft.com/docs/plugins/hooks-and-events" rel="nofollow">http://buildwithcraft.com/docs/plugins/hooks-and-events</a></p>

<p>Then lookup the value, run validation and even return a custom error message if things were not saved correctly.</p>

<p>Hope this helps.</p>

CC BY-SA 3.0
2014-07-28T20:34:19.403Z
2014-07-28T20:34:19.403Z
Adam McCombs
<p>Is it possible to execute a custom function on the entry crud methods? Basically what I want to achieve is that a CP user with certain field value cannot read or save an entry that doesn't have the same field value. (in this case company) Are there any hooks/events available on that level? On group permission level I just want all permissions set to allow on that section. </p>

<p>Thanks in advance</p>

CC BY-SA 3.0
2014-07-28T20:46:29.077Z
What i'm interested in (been browsing in the code a but but didn't find anything) is there an event raised after reading or validating the entry? So I can decide last minute to show the entry or not based on custom criteria . Thanks
pythic
CC BY-SA 3.0
2014-07-28T20:54:30.320Z
EntryRecord is a child of yii's CActiveRecord. Can I just listen for onAfterFind then?
pythic
<plugin-development><entries>
Is it possible to execute a custom function on the entry crud methods?
# Is it possible to execute a custom function on the entry crud methods?

(Asked by: username_0 on 2014-07-28)

Is it possible to execute a custom function on the entry crud methods? Basically what I want to achieve is that a CP user with certain field value cannot read or save an entry that doesn't have the same field value. (in this case company) Are there any hooks/events available on that level? On group permission level I just want all permissions set to allow on that section.

Thanks in advance

**Tags:** plugin-development, entries

> **Comments:**
> **username_0**: What i'm interested in (been browsing in the code a but but didn't find anything) is there an event raised after reading or validating the entry? So I can decide last minute to show the entry or not based on custom criteria . Thanks  
> **username_0**: EntryRecord is a child of yii's CActiveRecord. Can I just listen for onAfterFind then?  

---

## 1 answers

### Answer by username_1 on 2014-07-28. Score: 4

You'd have to create a plugin but you could listen for the **entries.saveEntry** event that is noted here: <http://buildwithcraft.com/docs/plugins/hooks-and-events>

Then lookup the value, run validation and even return a custom error message if things were not saved correctly.

Hope this helps.


---

