Hi all, is there a way in payload to alert a user if they are deleting an item that is referenced somewhere else?
e.g. If I have a collection of
and these are used as a reference on the
. A user can select what
they wish to show on the
If a user removes a
, it breaks the
as the reference no longer exists. I would like to alert or stop the user from deleting that news post until they have removed the reference. Is this possible?
You could use a beforeDelete hook on the newsPost collection and check if the homePage references this Post. If so you could then throw an error to prevent the post from being deleted.
But i don't know if this is the best solution bc when there are many collections that can reference this collection (e.g. Media) all these collections have to be checked one by one.