It may be useful to display data related to the logged-in user. To do that, you can reference current user attributes in a Connected item query.
The $currentUser variable is available and exposes 5 attributes:
Returns a string which corresponds to the logged-in user display name
|String||emailAddress||Returns a string which corresponds to the logged-in user email address||$currentUser.emailAddress|
|String||Returns a unique identifier which corresponds to the logged-in user Atlassian account ID|
|String||Returns a string which corresponds to the logged-in user locale|
|String||Returns a string which corresponds to the logged-in user timezone|
Referencing properties of the current user works the same way as referencing the value of other Connected items.
Here is an example:
SELECT role, manager FROM employees WHERE name = $currentUser.displayName
is evaluated to:
SELECT role, manager FROM employees WHERE name = 'Brice Gestas'
Don't enclose $currentUser with double quotes
When using a SQL datasource, the $currentUser dependencies must no be enclosed with " (double quotes). The enclosing is done automatically by Elements Connect.
The query below will not work:
// This query will not work - Do no enclose $currentUser dependencies with double quote SELECT role, manager FROM employees WHERE name = "$currentUser.displayName"
What about the email address?
Elements Connect is a trusted Atlassian application. This means that we can always have access to the current user's email address, without having to manually enable it from personnal accounts. If a restriction is still in place, please manually upgrade Elements Connect to the latest version.