Assets support in Outbound notifications

Assets support in Outbound notifications

Summary

Here we provide additional information and examples about how asset field data can be accessed within Outbound notifications template using Velocity. (Learn more about Assets)

Access to asset field data

In outbound notification template you can use the asset field data, getting it from the $context.issue.fields object.

Here is an example of asset field possible format in the $context

"customfield_10543": [ { "workspaceId": "f81935d0-59b5-4263-9abe-005b8a89262f", "id": "f81935d0-59b5-4263-9abe-005b8a89262f:45", "objectId": "45", "label": "Galaxy S26 Ultra Cobalt Violet 1TB", "objectKey": "MAS-45", "avatar": { "url16": "https://assets-media.atlassian.com/assets/icons/icons16/Phone.png", "url48": "https://assets-media.atlassian.com/assets/icons/icons48/Phone.png", "url72": "https://assets-media.atlassian.com/assets/icons/icons48/Phone.png", "url144": "https://assets-media.atlassian.com/assets/icons/icons48/Phone.png", "url288": "https://assets-media.atlassian.com/assets/icons/icons48/Phone.png" }, "objectType": { "workspaceId": "f81935d0-59b5-4263-9abe-005b8a89262f", "objectTypeId": "42", "id": "f81935d0-59b5-4263-9abe-005b8a89262f:42", "name": "Phones", "icon": { "id": "bf283736-f5be-4e0d-b500-2fec8f28c86e", "name": "Phone", "url16": "https://assets-media.atlassian.com/assets/icons/icons16/Phone.png", "url48": "https://assets-media.atlassian.com/assets/icons/icons48/Phone.png" }, "objectSchemaId": "34" }, "attributes": [ { "workspaceId": "f81935d0-59b5-4263-9abe-005b8a89262f", "objectTypeAttributeId": "132", "objectTypeAttribute": { "workspaceId": "f81935d0-59b5-4263-9abe-005b8a89262f", "id": "132", "name": "Name", "label": true, "type": 0, "description": "The name of the object", "defaultType": { "id": "0", "name": "Text" } }, "objectAttributeValues": [ { "value": "Galaxy S26 Ultra Cobalt Violet 1TB", "displayValue": "Galaxy S26 Ultra Cobalt Violet 1TB", "searchValue": "Galaxy S26 Ultra Cobalt Violet 1TB" } ] }, { "workspaceId": "f81935d0-59b5-4263-9abe-005b8a89262f", "objectTypeAttributeId": "134", "objectTypeAttribute": { "workspaceId": "f81935d0-59b5-4263-9abe-005b8a89262f", "id": "134", "name": "Serial Number", "label": false, "type": 0, "defaultType": { "id": "0", "name": "Text" } }, "objectAttributeValues": [ { "value": "33333", "displayValue": "33333", "searchValue": "33333" } ] } ], "links": { "self": "https://your-site.atlassian.net/gateway/api/jsm/assets/workspace/f81935d0-59b5-4263-9abe-005b8a89262f/v1/object/45" } } ]

Velocity script example to use asset field data with ID customfield_10543:

#macro ( customIncludeAssetFieldText $fieldId) #set ($fields = $context.issue.fields) #set( $field = $fields.path($fieldId) ) #if($jemhUtils.isNotNull($field)) $jemhUtils.setFieldRendered() "#getFieldName($fieldId)[$fieldId]": #foreach($asset in $field.elements()) Item: $foreach.count #foreach($attribute in $asset.path("attributes").elements()) "$attribute.findValue("name").asText()": $attribute.findValue("value").asText() #end #end #end #end ##_______ Test macro - include Asset field _______ #customIncludeAssetFieldText('customfield_10543')

Setup to reveal asset filed attributes

In order to make asset field attributes visible in the $context, some Jira field configuration is required.

Go to your Jira site administration settings > Work items > Fields > [YOUR ASSET FIELD] > Actions > > Contexts and default values > Edit Assets object/s field configuration

image-20260922-141500.png
image-20260922-141545.png

 

On page Assets objects field configuration pick specific attribute in the field User interaction > Display these attributes in the issue view
and save the changes.

image-20260922-144113.png

Once the new attribute is added, in subsequent webhook events $context will start to include it in the attributes property of the specific asset field.