Elements Connect

Dependencies on the current user

When fetching data from an external source, it can be useful to display information specific to the currently logged-in Jira user - for example, a user's records in a CRM, assets assigned to them in an inventory, or their profile in an identity provider like Azure AD or Okta.

Elements Connect provides the $currentUser variable for this. You can reference the current user's attributes when configuring the query of a connected custom field or a connected item.Current user attributes

The $currentUser variable exposes 5 attributes you can use in your queries:

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.

$currentUser can’t be used along with post-function as it’s Elements Connect app which would be identified as user when running post-function.