# Run rules on delete event

**URL:** <https://community.fibery.io/t/run-rules-on-delete-event/2013>\
**Category:** Get Help\
**Created:** [September 14, 2021, 9:38am UTC](https://community.fibery.io/t/run-rules-on-delete-event/2013 "2021-09-14T09:38:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Vabishchevich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/eugene_vabishchevich/32/4310_2.png) [@Eugene\_Vabishchevich](https://community.fibery.io/u/Eugene_Vabishchevich)\
**Post date:** [September 14, 2021, 9:38am UTC](https://community.fibery.io/t/run-rules-on-delete-event/2013/1 "2021-09-14T09:38:19Z")

</div>

It would be great to run rules on delete event. For instance, we wanted to delete all child records when a parent is deleted.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [September 14, 2021, 9:49am UTC](https://community.fibery.io/t/run-rules-on-delete-event/2013/2 "2021-09-14T09:49:58Z")

</div>

The easiest way to achieve this is to write a rule for the child type that the entity will delete itself when it has no parent (I call my rule ‘suicide if orphan’!)

---

<div class="post-metadata">

**Author:** ![Eugene\_Vabishchevich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/eugene_vabishchevich/32/4310_2.png) [@Eugene\_Vabishchevich](https://community.fibery.io/u/Eugene_Vabishchevich)\
**Post date:** [September 15, 2021, 10:25am UTC](https://community.fibery.io/t/run-rules-on-delete-event/2013/3 "2021-09-15T10:25:00Z")

</div>

It works like a workaround but the behavior is not expected in general 🙂

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [September 15, 2021, 10:29am UTC](https://community.fibery.io/t/run-rules-on-delete-event/2013/4 "2021-09-15T10:29:14Z")

</div>

> [@Eugene\_Vabishchevich](#):
>
> the behavior is not expected in general

How so? What is not working as you would expect?

---

<div class="post-metadata">

**Author:** ![Eugene\_Vabishchevich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/eugene_vabishchevich/32/4310_2.png) [@Eugene\_Vabishchevich](https://community.fibery.io/u/Eugene_Vabishchevich)\
**Post date:** [September 15, 2021, 10:41am UTC](https://community.fibery.io/t/run-rules-on-delete-event/2013/5 "2021-09-15T10:41:10Z")

</div>

You can create a child record but forget about the connection field (currently we don’t have validation rules or required fields functionality). With your proposal a new record will be deleted.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [September 15, 2021, 1:36pm UTC](https://community.fibery.io/t/run-rules-on-delete-event/2013/6 "2021-09-15T13:36:53Z")

</div>

> [@Eugene\_Vabishchevich](#):
>
> With your proposal a new record will be deleted.

Actually not. It will only be deleted if it is updated from having a parent to having no parent.  
When the child is initially created (with no parent) it will survive.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/c/cdee6d1bf8bddddf106f0dc63b9506bb08c64b2d.png)
