> For the complete documentation index, see [llms.txt](https://docs.buzzy.buzz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.buzzy.buzz/the-building-blocks/datatables-fields-and-data/hiding-a-field-based-on-role-using-a-display-formula.md).

# Hiding a field based on role using a display formula

You can show and hide fields or screen elements with a [Display Formula](/the-building-blocks/datatables-fields-and-data/display-formula.md). Display formulas use JSONata and can reference the current user, row fields, form values, and context data.

For example, to show a field only to owners or authors, set the field or element visibility mode to `Show` and use:

```
user.highestRole = 'owner' or user.highestRole = 'author'
```

Another example:

```
(user.highestRole = 'owner'  or user.highestRole = 'author')  or $not(user._id in viewers)
```

where `user._id` is the current user's ID.

This checks that the user is an owner or author, or is not in the row's viewers list. It gives you flexibility to change the interface based on the row viewers and the signed-in user.

You can also check whether the current user created the row:

```jsonata
user._id = userID
```

Display formulas are for interface behavior, not security. Hiding a field or element does not by itself prove that the user cannot access the underlying data. For security, configure row access, field access, Teams, People settings, and [Private Data](/the-building-blocks/datatables-fields-and-data/private-data.md). Use the [In-App Debugging](/troubleshooting/in-app-debugging.md) when a display rule does not evaluate the way you expect.

***
