Hello! I'm trying to do a soft delete for a collection. What I want to achieve is to show
deletedAt
on
read
(only for Admin dashboard) only when is not undefined. The issue is that I can't achieve this. I tried using
field.access
:
{
name: 'deletedAt',
type: 'date',
label: {
en: 'Deleted at',
ro: 'Șters la',
},
access: {
create: () => false,
read: ({ data }) => {
return data ? data.deletedAt !== undefined : false;
},
update: () => true,
},
},
But from what I see, first the Admin is calling the
/access
to see if has access, but in this step the
data
is undefined. After
/access
a new request is made to the request itself and I have access to
data
. The problem is that in the
Admin
only the
/access
matter when it comes to showing the field or not.
What I can do to achieve this?
Adding
admin.condition
solved the issue.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.