Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

While retrieving an Asset object from an Asset custom field in Jira is possible via the insightFieldValue custom Nunjucks filter, not all attributes of that Asset object can be returned with it. However, the filter returns the Asset object’s URL, and we so you can leverage Jira Cloud’s Asset API to obtain other object attributes.

...

Code Block
{% set assetURL = issue | insightFieldValue( "customfield_xxxxx", true ) | first | field("links.self") %}
{{assetURL | callRest(options = { "auth": 
  { "username": "your email address tied to your Atlassian account",
    "password": "your Atlassian API token value" 
  }
})
| field("attributes") | filter({"objectTypeAttributeId":"the object attribute ID"}) | field("objectAttributeValues") | first | field("value") }}

Parameters to take note ofyou need to update with your specific information:

  1. customfield_xxxxx: This should be the ID of the Asset custom field.

  2. username: The email address used to log in to your Atlassian account.

  3. password: The value of an Atlassian API token generated ; you can generate a new token using the instructions at https://id.atlassian.com/manage-profile/security/api-tokens.
    (Note: the token value is only visible immediately after generation).

  4. objectTypeAttributeId: The Asset object’s attribute ID - you . You can view the ID of the Asset attribute by selecting your Asset object from the list at https://your-jira-cloud-site.atlassian.net/jira/servicedesk/assets and browsing the Attributes section.

For Jira Cloud APIs related to Assets you can use, you can consult please see https://developer.atlassian.com/cloud/assets/rest/api-group-aql/#api-group-aql.

...