userHasRole

To return Yes (true) if a user has a given role

Check with this function if the current or a given user has a specific role.

Syntax

userHasRole(string)

userHasRole(user, string)

Return

boolean

Examples

userHasRole(role) To return Yes (true), if the current user has a given role.

userHasRole("admin")

Result: Yes (true) if the current user has the admin role

userHasRole(myUser, role) To return Yes (true) if a given user has a given role.

userHasRole('Created by', "admin")

Result: Yes (true) if the creator of the selected record has the admin role

See also

user, which returns the current or a specific user.

Do you want to dive deeper into the topic? Take a look at the corresponding part of our video tutorial.

Last updated