# Best way to 'archive' an entity?

**URL:** <https://community.fibery.io/t/best-way-to-archive-an-entity/2284>\
**Category:** Get Help\
**Created:** [December 1, 2021, 6:49pm UTC](https://community.fibery.io/t/best-way-to-archive-an-entity/2284 "2021-12-01T18:49:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimitri\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/dimitri_s/32/1683_2.png) [@Dimitri\_S](https://community.fibery.io/u/Dimitri_S)\
**Post date:** [December 1, 2021, 6:49pm UTC](https://community.fibery.io/t/best-way-to-archive-an-entity/2284/1 "2021-12-01T18:49:06Z")

</div>

I don’t really like the method of just setting the state to “Archived” because then it becomes something I constantly have to filter out.

I also don’t really like the Convert To option because (correct me if I’m wrong) it requires that I manually keep the field names in sync and it also breaks relationships.

Seems like this could be something that requires a script which a) moves the entity to another “Archive” space and b) re-establishes the relationships.

Any other ideas?

* * *

To provide a use-case for this, say I have an **Orders** space and a **Products** space. Orders have products. If I decide to stop carrying a product I want to archive it but still keep the record of orders accurate, to be able to calculate monthly sales, etc.

---

<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:** [December 1, 2021, 7:02pm UTC](https://community.fibery.io/t/best-way-to-archive-an-entity/2284/2 "2021-12-01T19:02:50Z")

</div>

> [@Dimitri\_S](#):
>
> it requires that I manually keep the field names in sync

unfortunately, yes.

> [@Dimitri\_S](#):
>
> it also breaks relationships.

actually not. if the relations are configured identically, the links to other entities are maintained.

> [@Dimitri\_S](#):
>
> If I decide to stop carrying a product I want to archive it but still keep the record of orders accurate, to be able to calculate monthly sales, etc.

It should be OK for this use case, provided that you have identical databases (e.g. ‘Current products’ and ‘Discontinued products’)  
Or at least identical in the important fields (maybe some fields aren’t needed for discontinued products).  
Of course, you need to remember to delete the original entity after duplicating.

Your Orders database will now have two collections - one for ‘Current products’ and one for ‘Discontinued products’. And actually, this might help prevent people creating a new order for a discontinued product.

---

<div class="post-metadata">

**Author:** ![Oshyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oshyan/32/11431_2.png) [@Oshyan](https://community.fibery.io/u/Oshyan)\
**Post date:** [December 4, 2021, 12:04am UTC](https://community.fibery.io/t/best-way-to-archive-an-entity/2284/3 "2021-12-04T00:04:46Z")

</div>

Before trying to address this, either with existing features, or some open feature requests, I would first ask: what does “archived” status mean _to you_? What specific results/outcome/effects do you want this status or action to have/create/etc? I ask because I do think there are several existing requests which might be related to some or all of your needs. For example:

> [@Filter search results based on Field Values](https://community.fibery.io/t/add-filter-for-closed-entities-in-all-searches-and-or-other-indicator-of-entity-status/1052):
>
> The more I actually use Fibery day-to-day, the more tasks I complete, and the more “closed” entities I end up with. Yet they all still show up in my searches. This really limits the usefulness of search at times, whether in the Ctrl-K pop-up or in-line entity linking (this is even more of an issue due to [Narrow texts in entity search pop-up make correct selection difficult](https://community.fibery.io/t/narrow-texts-in-entity-search-pop-up-make-correct-selection-difficult/1051). I’m not sure the best way to handle this. I know the “status” is a feature of the Workflow Extension. It seems important e…

> [@\[DONE\] Seeing "Closed" Entities grayed out in Search Dialog](https://community.fibery.io/t/seeing-closed-entities-grayed-out-in-search-dialog/1298):
>
> As my Fibery instance grows, and the number of entities also grow, it’s becoming harder to find things with the limited search functionality while we wait on better indexing of content, and filters in that dialog. One thing that would really help short-term is adding the excellent “graying” you guys do of Entities with a “closed” type of State. It would be very helpful to see when in the Search Dialog simply closed entities as “gray.” Often I want to link live tasks to other places, like comm…

---

<div class="post-metadata">

**Author:** ![Dimitri\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/dimitri_s/32/1683_2.png) [@Dimitri\_S](https://community.fibery.io/u/Dimitri_S)\
**Post date:** [December 8, 2021, 1:16am UTC](https://community.fibery.io/t/best-way-to-archive-an-entity/2284/4 "2021-12-08T01:16:23Z")

</div>

So to give you some context in Google Drive I have a “Clients” folder which has active clients I am currently working with and inside this folder is also an “Archive” folder. When I get done with a client I move their folder into the Archive folder so its out of sight out of mind unless I need it for some reason.

I’m basically trying to replicate this kind of functionality.

In either case I decided to move forward with the “a script which a) moves the entity to another “Archive” space and b) re-establishes the relationships.” approach. A simplified version of how I am doing this is shared here:

> [@Script equivalent of the "Convert to" feature?](https://community.fibery.io/t/script-equivalent-of-the-convert-to-feature/2296/2):
>
> Figured it out but leaving this up here for others reference. Here is my script equivalent of the Convert to feature but with the ability to map to dissimilarly named fields. const fibery = context.getService("fibery"); for (const entity of args.currentEntities) { await fibery.createEntity("Space B/Db Y", { "Person Name": entity["Name"], "Person Salary": entity["Salary"], }); await fibery.deleteEntity(entity.type, entity.id); }
