The Person data type is specific to database properties that allow for users to be selected or displayed, such as the Person, Created by, and Last edited by properties. When dealing with a Person data type, you can use the name
and email
functions to return further information about the users in each field.
name(prop("Created By")) /* Output: "Thomas Frank" */
email(prop("Created By")) /* Output: "info@collegeinfogeek.com" */
Code language: PHP (php)
Using name
and email
directly like above will only work on properties that only return one person by default, such as Created by and Last edited by. If you wish to use these functions on Person property, you will either need to target the first item with first
, or utilise map
to return the name or email for each person added to the field.
prop("Assignee").first().email()
/* Output: "info@collegeinfogeek.com" */
prop("Assignees").map(current.email())
/* Output: ["info@collegeinfogeek.com", "ben@collegeinfogeek.com" */
Code language: PHP (php)
Good to know: The email comes back as plain text, not a link. You would need to use the link
function and the mailto:
prefix to create a clickable email address.