# \[Automations\] Deleting entities with nested collections

**URL:** <https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33>\
**Category:** Ideas & Features\
**Tags:** automations\
**Created:** [October 23, 2018, 10:15am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33 "2018-10-23T10:15:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julie\_Vasilyeva](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@Julie\_Vasilyeva](https://community.fibery.io/u/Julie_Vasilyeva)\
**Post date:** [October 23, 2018, 10:15am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/1 "2018-10-23T10:15:09Z")

</div>

It would be useful to have the possibility to delete the entity (f.ex. Feature) with all it’s sub-levels or have an option to move them to another entity (of the same level maybe).

---

<div class="post-metadata">

**Author:** ![rickcogley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rickcogley/32/274_2.png) [@rickcogley](https://community.fibery.io/u/rickcogley)\
**Post date:** [December 8, 2018, 11:24am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/2 "2018-12-08T11:24:27Z")

</div>

Yes, chiming in, I can see a need for both the idea of cascading deletes, and also cascading deactivations, so that board filtering will work effectively. As you use the app over time, you will have a lot of sets of multilevel data, and while you might not want to delete it, there should be a way to flag it somehow.

```auto
Client A - Active? [√]
   |__Contract - Active? [√]
         |__SOW - Active? [√]
         |__SOW - Active? [√]
Client B - Active? [x]
   |__Contract - Active? [x]
         |__SOW - Active? [x]
         |__SOW - Active? [x]

```

But there are also times that, even if you mark an Employee as having left (inactive), you want the entities they created to live on…:

```auto
Employee - Active? [x] 
   |__Wiki-Page - Active? [√]
         |__Attachment - Active? [√]

```

---

<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:** [July 16, 2020, 9:59am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/3 "2020-07-16T09:59:16Z")

</div>

Would it be possible to define relationships so that an entity’s existence is dependent upon another related entity? For example, if a Project contains many Tasks, when the Project is deleted, all Tasks that were associated with the Project are deleted too. In other words, a Task cannot have a life of its own, so effectively, the Project relationship is a mandatory field for a Task.

---

<div class="post-metadata">

**Author:** ![Jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jean](https://community.fibery.io/u/Jean)\
**Post date:** [July 16, 2020, 10:06am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/4 "2020-07-16T10:06:44Z")

</div>

Yeah, that’s another thing I’m missing from Clickup. I think that can be easier accomplished via automations. Automations will be a huge feature in Fibery and I think it should be prioritized.

---

<div class="post-metadata">

**Author:** ![mdubakov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mdubakov/32/10_2.png) [@mdubakov](https://community.fibery.io/u/mdubakov)\
**Post date:** [July 16, 2020, 10:39am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/5 "2020-07-16T10:39:51Z")

</div>

This will be done with Automations. However, don’t expect it in the next 3 months. I hope we will start working on automations in the Fall.

---

<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:** [July 16, 2020, 10:53am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/6 "2020-07-16T10:53:14Z")

</div>

Good to know, and your transparency about the roadmap is appreciated.

---

<div class="post-metadata">

**Author:** ![Polina\_Zenevich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/polina_zenevich/32/480_2.png) [@Polina\_Zenevich](https://community.fibery.io/u/Polina_Zenevich)\
**Post date:** [July 16, 2021, 6:36pm UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/7 "2021-07-16T18:36:03Z")

</div>

Hi all 🙂  
Glad to say, that this is already possible with Automations already - but in terms of 1 step hierarchy.  
So, if you have Project - with one click you delete Project and all the linked Tasks.

You can’t (for now at least): Delete Project, linked Tasks and linked Subtasks - that improvement is in the backlog although 🙂

---

<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:** [July 16, 2021, 9:14pm UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/8 "2021-07-16T21:14:51Z")

</div>

Isn’t it the case that you can automate deletion of all children, grandchildren, great grandchildren etc. through unlimited hierarchy, so long as all the relationships are 1:n (parent:child)?  
Namely, by setting a rule for each child type that if count of parents = 0 then delete entity…  
Right?

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [July 19, 2021, 9:44am UTC](https://community.fibery.io/t/automations-deleting-entities-with-nested-collections/33/9 "2021-07-19T09:44:27Z")

</div>

Hi, @Chr1sG

It is nice idea. I checked that and it works. Please find below the example on how nested collections can be cleaned.

Let’s assume we have three levels on hierarchy.

Story  
– Task  
-----Sub Task

1. Create rule for subtask on changes related to it’s task: “Remove subtask if it’s task is empty”  

2. Create rule for task on changes related to it’s story: “Remove task if it’s story is empty”  

It means that every time when story will be deleted then story’s tasks will be updated with empty story  
and then these tasks with empty story will be deleted with the defined second rule. Subtasks will be updated with empty task and then will be deleted with the first rule since subtasks have empty task field.

Thanks,  
Oleg
