getAttributeFromAsset()

Text

This function returns the attribute value for a given asset object key. If the provided key, the attribute ID or name is invalid or empty, null is returned. If the attribute is configured to allow multiple values, these values are returned as a comma‑separated list.

By default, the function returns the textual representation of the attribute value. For some non‑standard attribute types (for example users, projects, etc.), the function returns specific values that are optimized for these types. The exact behavior for these special attribute types is described in the list below.

Attribute type

Attribute value returned

object

object key, e.g."PTAS-1"

user

user account id

group

group name, e.g. "my-jira-group"

project

project id, e.g. "10005"

status

name, e.g. "Active"

Bitbucket cloud repository

repository UUID

Bash
getAttributeFromAsset(objectKey, attributeId) #Output: Text
getAttributeFromAsset(objectKey, attributeName) #Output: Text

Example

Parser expression

Description

Bash
%{getAttributeFromAsset("PTAS-1", "123")}

This example returns the value of the attribute with ID "123" (attribute type Default/Text) for the asset object with object key "PTAS-1", e.g.:
PHONE-001

Bash
%{getAttributeFromAsset("PTAS-1", "Name")}

This example returns the value of the attribute "Name" (attribute type Default/Text) for the asset object with object key "PTAS-1", e.g.:

PHONE-001

Bash
%{getAttributeFromAsset("PHONE-001", "Created")}

This example returns the value of the attribute "Created" (attribute type Default/Date time) for the asset object with object key "PHONE-001", e.g.:

2024-09-30T10:00:00.000T+02:00

The output format for Date Time attributes is the same as in the Date Picker.

Bash
%{getAttributeFromAsset("PTAS-1", "Associated Project")}

This example returns the value of the attribute "Associated Project" (attribute type Project) for the asset object with object key "PTAS-1", e.g.:

10001,10004

For the Project attribute type, project IDs are returned.

Bash
%{getAttributeFromAsset(%{issue.cf12566},"Project team")}

This example returns the value of the attribute "Project team" (attribute type User) for the asset object (for example, from a assets objects custom field with a single object), e.g:

557058:13380c58-4287-4135-9e04-4edec2fafebc,557058:5ed8d5af-b3a8-47dc-9933-b1a815a6cf92,557058:16adef20-023f-44f6-a02c-208f1b6dd736

For the User attribute type, Atlassian account IDs are returned.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

objectKey

text

Text containing a valid single asset object key.

attributeId

text

Text containing a valid asset object attribute ID.

attributeName

text

Text containing a valid asset object attribute name.

Output

This function returns a text


Text list

Variant for multiple asset objects. In case one of the given keys is not valid or empty,  null is returned to its position on the list.

Bash
getAttributeFromAsset(objectKeys, attributeId) #Output: Text list
getAttributeFromAsset(objectKeys, attributeName) #Output: Text list

Examples

Parser expression

Description

Bash
%{getAttributeFromAsset(["PTAS-1","PTAS-2"], "Name")}

This example returns the value of the attribute "Name" (attribute type Default/Text) for the asset objects with object key "PTAS-1" and "PTAS-2", e.g.:

PHONE-001, PHONE-002

Bash
%{getAttributeFromAsset(["PTAS-1","PTAS-2"], "Associated Project")}

This example returns the value of the attribute "Associated Project" (attribute type Project) for the asset objects with object key "PTAS-1" and "PTAS-2", e.g.:

10001,10004,10003

For the Project attribute type, project IDs are returned. Since technically, the output is a text list possibly consisting of comma-separated values, e.g. "10001,10004","10003", you might want to flatten the list by applying toString() to the result.

Bash
%{getAttributeFromAsset(%{issue.cf12345},"Associated User")}

This example returns the value of the attribute "Associated User" (attribute type User) for the asset objects (for example, from an assets objects custom field with multiple objects), e.g:

557058:13380c58-4287-4135-9e04-4edec2fafebc,557058:5ed8d5af-b3a8-47dc-9933-b1a815a6cf92,557058:16adef20-023f-44f6-a02c-208f1b6dd736

For the User attribute type, Atlassian account IDs are returned.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

objectKeys

text LIST

Any valid text list containing asset object keys.

attributeId

text

Text containing a valid asset object attribute ID.

attributeName

text

Text containing a valid asset object attribute name.

Output

This function returns a text LIST

(books) Use cases and examples