Hiding a field based on role using a display formula
You can show and hide fields based on formula using JSONATA. For example, if you wanted to only show certain fields based on a setting or some value including role, use this formula:
user.highestRole = 'owner' or user.highestRole = 'author'
in the field settings
Aonther example of this is
(user.highestRole = 'owner' or user.highestRole = 'author') or $not(user._id in viewers)
user._id is the user ID of the current logged in user.
In that example, it checks that the user is an owner or author and is not a viewer , this provides additional flexibility to show/hide fields based on viewers, and current logged in user.
You could also check to see if the current user is the creator of the row with
user._id = userID , where
userID is the user ID of the the user who created the row and
user._id is the currently logged in user.
Note, currently, hiding a field does not stop the data being sent to the client from the server. So the data is there, it’s just hidden. So do not use this for security. For security, you’d be better storing the secure data in a separate microapp, which controls the security correctly, and then use “cross app” fields to link them.