How to show attachments in Issue Navigator

Is there any way to show in a column in Issue Navigator the names of the attachments for an issue?

Thanks in advance,

2 answers

1 accepted

Currently not possible - https://jira.atlassian.com/browse/JRA-4737

However you might be able to implement that using custom scripted field (Script Runner) which will display attachment names for an issue and you'll be able to add it as a column in the issue navigator.

Here's a sample groovy code for the field:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys

def attachments = ComponentAccessor.getAttachmentManager().getAttachments(issue)
def baseUrl = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL)

attachments.collect {
    '<a href="' + baseUrl + '/secure/attachment/'+ it.id +'/'+
        URLEncoder.encode(it.filename, "UTF-8") +'">' + it.filename + '</a>'
}.join("<br>")

(Modified by @Jamie Echlin [Adaptavist] to support attachment filenames containing spaces Nov 2016).

Use script field config: Template: HTML.

 

Thanks for sharing the script.

Thank you, @Jamie Echlin [Adaptavist]!!

You're welcome, and thanks to @Boris Georgiev [Botron] too wink

This is better, it gives you clickable file names (to download them) and also lists multiple attached file names:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys

def attachments = ComponentAccessor.getAttachmentManager().getAttachments(issue)
def baseUrl = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL)

attachments.collect {
'<a href="' + baseUrl + '/secure/attachment/'+ it.id +'/'+
URLEncoder.encode(it.filename, "UTF-8") + '"' + '>' + it.filename + '</a>' + '<br>'
}.join('<br>')

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,239 views 14 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot