Learn how to set up and use the archive functionality to declutter your views, improve workflow, and maintain a clean data structure without permanently deleting items.
Speaker 0: Hello, and welcome back to yet another episode of Short Hops. I'm your host, Brian Gillespie. Today, I wanna cover the soft delete features inside Directus. It's called archive. So the archive feature allows you just to move records or items out of your way that are archived, that are no longer needed.
Alright? So the example that we have here is our inbox. You can see I've got a couple of new items that have arrived in the inbox with, you know, contact forms and newsletter. Some of these things I need to take care of. Some of them have already been assigned.
Some of them have already been closed. That's great. What do I what if I wanna get rid of these ones that are closed, get them out of my view? You know, I could certainly come in and create a filter for that using the filters inside Directus, really easy. Isn't empty or, I'm sorry, isn't does not equal closed.
Right? So I could save that as the default view, but I've got another option. And that is using the archive feature. So to find that, I just go to the specific collection that I wanna edit. In that case, this is the inbox.
I'm gonna scroll down the page until I come across the archive settings. So I'm gonna choose the archive field, which is basically what field do we wanna act on to archive or unarchive records. And then we want to enable this. And then we're gonna add a value. So if the value is closed we're gonna archive that record.
If we unarchive something we bring it back, we're gonna set the value to new. Right? And that's really all we have to do in this case. We go back to our inbox and now you can see I don't see any of these records that have been closed. And this one that came in 19 hours ago, if I go in and just do like a quick edit on that, change this to closed, you can see that no longer shows up.
Now on the right hand side bar, I get a new archive option. So I could show active items, I could show archived items, or I could show all of them. And then if I wanna bring an item back, I could just click in it or, and click this unarchive option, and that will change the status for me. Or I could manually change the status or I could do this in bulk by just setting the status to assigned, right? And now I no longer have those archived items.
Now super simple, great little UX addition. One thing to remember though, this does not necessarily apply to the actual API. You know, this is only inside the data studio. If you want like a soft delete feature inside the API you can either do that using permissions or when you run your API calls, you wanna make sure that you look for the ones where status is new or assigned. So these settings only apply within the data studio.
And with that, that's it for this episode of Short Hops. Stay tuned for the next one.