user
To return the current or a specific user
There is not much to say about this function; it just returns the name or email of the current user. That's it. Wait, you can check if a specific user is using the database right now!
In combination with the field type User you can show specific records only to specific users.
Syntax
user()
user(string)
Return
user
Example
user()
To return the current user.
user()
Result: Olaf Scholz (if Olaf Scholz is currently using the database)
user(myUsername)
To return a user. There is no return if the given username doesn't match the name of any member of the workspace (team).
user("Boris Johnson")
Result: No return, i.e. an empty field, if Boris Johnson is not a member of the workspace (team)
user() = user("Olaf Scholz") or user() = user("Emmanuel Macron")
Result: Yes (if the current user is Olaf Scholz or Emmanuel Macron)
Choose the User field and select Olaf Scholz.
user() = 'Assigned to'
Return: Yes (with the User field Assigned to having the value Olaf Scholz)
If added in the field Readable if in the table settings, you'll only see the records assigned to Olaf Scholz only in case you are Olaf Scholz.
See also
userEmail
, which returns the email address of a user.
userHasRole
, returns Yes (true) if a user has a given role.
userId
, which returns the ID of a user.
userName
, which returns the username of a user.