Skip to main content
Skip table of contents

Dependencies on the current user

When fetching data from an external source, it can be useful to display data that is only related to the user currently logged in Jira.

To do that, Elements Connect allows you to reference specific attributes when setting up your query, either for connected custom fields or connected items, with the help of the $currentUser variable.

Current user attributes

This variable exposes 5 attributes:

Name

Type

Description

Example

displayName

String

Returns the display name of the logged-in user.

$currentUser.displayName

> "John Doe"

emailAddress

String

Returns the email address of the logged-in user.

$currentUser.emailAddress

> "john.doe@elements-apps.com"

accountId 

String

Returns the unique Atlassian account ID of the logged-in user.

$currentUser.accountId

> "8878ccae-33566-3e50-b27a"

locale 

String

Returns the locale language of the logged-in user.

$currentUser.locale

> "fr_FR"

timeZone 

String

Returns the timezone of the logged-in user.

$currentUser.timeZone

> "Europe/Berlin"

Example

Referencing properties of the current user works the same way as referencing the value of other connected fields when creating dependencies.

The SQL query:

SQL
SELECT manager
FROM employees
WHERE name = $currentUser.displayName

is interpreted as:

SQL
SELECT manager
FROM employees
WHERE name = 'John Doe'

This query will only retrieve the manager of the user currently logged-in, which can be interpreted differently depending on this user.

Do not enclose $currentUser with double quotes

When using a SQL datasource, the $currentUser dependencies must not be enclosed with " (double quotes). The enclosing is done automatically by Elements Connect.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.