userAccountId()

User name

This function returns the Atlassian account ID for a given user display name or email address. In case the given text is not a valid display name (or email address) of a user, an empty text is returned. In case multiple users have the same display name/email address, the first one is returned.

Bash
userAccountId(userName) #Output: Text

Examples

Parser expression

Description

Bash
%{userAccountId("Bob Smith")}

This example returns the Atlassian account ID of the user Bob Smith, e.g.:

557058:145e0983-5707-439c-80e4-1160dd57f142

Bash
%{userAccountId("Will Smith")}

Assume, we have two users with the same name "Will Smith", the first with the Atlassian account ID "557069:145e0983-5707-439c-80e4-1160dd57f142", the second with "77cb4ae0e4b97ab11a18e99f5". Then the result would be

557069:145e0983-5707-439c-80e4-1160dd57f142, reflecting that the account ID of the first "Will Smith" is returned.

Bash
%{userAccountId("B.Smith@mydomain.com")}

This example returns the Atlassian account ID of the user with the email address B.Smith@mydomain.com, e.g.:

557058:145e0983-5707-439c-80e4-1160dd57f142

Bash
%{userAccountId("Smith")}

This example returns the Atlassian account ID of the first user whose name or email address includes Smith.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

userName

text

Text containing a valid user display name.

Output

This function returns a text


User list

Variant for multiple users. In case one of the given texts is not a valid display name of a user, an empty text is returned. In case multiple users have the same display name for an element of the list, the first one is returned.

Bash
userAccountId(userList) #Output: Text

Examples

Parser expression

Description

Bash
%{userAccountId(toStringList(%{issue.cf10021}))}

This example returns the Atlassian account ID of all users which are stored in the given custom text field (e.g. "John Doe, Mary Jones, Bob Smith").

To achieve this, the following functions are used:

Bash
%{userAccountId(["Bob Smith", "Dolly Jones"])}

This example returns the Atlassian account ID of the given two users, e.g.:

557058:145e0983-5707-439c-80e4-1160dd57f142, 5cb4ae0e4b97ab11a18e00c7

Bash
%{userAccountId(["Will Smith", "Dolly Jones"])}

Assume, we have two users with the same name "Will Smith", the first with the Atlassian account ID "557069:145e0983-5707-439c-80e4-1160dd57f142", the second with "77cb4ae0e4b97ab11a18e99f5". Dolly Jones has the account ID "5cb4ae0e4b97ab11a18e00c7". Then the result would be

557069:145e0983-5707-439c-80e4-1160dd57f142, 5cb4ae0e4b97ab11a18e00c7, reflecting that the account ID of the first "Will Smith" is returned.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

userList

text

Any valid text list containing user display names.

Output

This function returns a text


(books) Use cases and examples