How can I delete attachments from Issue on workflow post-function?

Question in a subject. We're handle sensitive data in attachments and want to purge all of them after reporter will aprove that he received them. Is there an easy way to automate this process?

5 answers

1 accepted

Download post-function plugin from here.

https://bitbucket.org/bhushan154/jira-delete-attachments-post-function/downloads#download-263211

Haven't tested it yet. Let me know if you have any issues.

I think I can expand my add-on https://marketplace.atlassian.com/plugins/ru.mail.jira.plugins.attachdeleter to add new post-function. I will create a issue in my bug tracker

That will be a very nice feature to have!

1 votes
Henning Tietgens Community Champion Nov 11, 2013

You can use the Script Runner plugin and code like this in a scripted workflow postfunction.

AttachmentManager attachmentManager = ComponentAccessor.attachmentManager

def attachments = attachmentManager.getAttachments(issue)
attachments.each {attachment ->
    attachmentManager.deleteAttachment(attachment)
}

Try using ComponentAccessor.getAttachmentManager()

And see similar artical.

Hope this helps you

Patina

Thanks, but writing a plugin for this procedure isn't an easy way for me :)

if you need to automate then you have to write postfunction or listener to do that job

else you can delete attachments by using rest api

/rest/api/2/attachment/{id}(DELETE)

check this

https://docs.atlassian.com/jira/REST/latest/#d2e3993

free plugin is there to delete all attachements at once

https://marketplace.atlassian.com/plugins/ru.mail.jira.plugins.attachdeleter

That's an interesting plugin but still not a lot difference between manual deleting.

Maybe there is a way to check existence of attachments in Issue on transition?

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 ...

2,804 views 11 18
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