Hi,
I'm creating the user roles, and I want to make the role of organization Manager require the field organization to be filled.
I am currently using validate on the organization field, such that I check if the role organizationMember was added or not. The issue is, the value is checked against the "current" state of user, such that I am able to add the role organizationMember without failing the check, but after the role being added, the check starts working and requesting the field organization to be filled.
I want to make it so the role cannot be added unless the field is filled.
{ name: 'organization', label: 'Organization', type: 'text', validate: (value, { user }) => { console.log(user) if (user?.roles.includes('organizationManager') || user?.roles.includes('organizationMember')) { return value ? true : 'Please provide a value' } return true; }, // relationTo: 'organizations', // hasMany: false, },