How to get size of Jira issue attachments and add the attachment size in custom fieldIf my Jira cloud storage is full I just want to filter using this field and delete attachments of the tickets whose attachments size are high
@shankara vijayendran
if you are open to use REST API, then one of the endpoints that can be used is
url = "<a href="https://your-domain.atlassian.net/rest/api/3/attachment/%7Bid" target="_blank" rel="nofollow noopener noreferrer">https://your-domain.atlassian.net/rest/api/3/attachment/{id</a>}"
You can read through the documentation at this link
Hello, Good day. If you are looking only at specific to attachment size. Then go to Settings >> Products >> Storage management. Thanks
Hello Mohanraj
Thanks for the input But I have automate this since every time I wont be able to go , check and deletePlease let me know if you have any other workaround
Hello vishal
Thanks for the input I have to fetch details of attachments with high mb size so that I can delete those attachments first
if you run the below JQL, it will give list of issues that have attachments
attachments IS NOT EMPTY
Then, you can loop through each issue key, using REST APIs, to find issues that have size > X.
Are you looking for other option like automation?
This should get you going.
Create an automation, with a scheduled trigger.
Trigger
In the trigger specify JQL
project = "TEST" and attachments IS NOT EMPTY
Uncheck below checkbox
This will return list of issues that have attachment. Then add Conditions
For demo purpose i just added a log statement to show that this approach works
You can add conditions based on file size, and then email list of issues or if you are comfortable, delete attachments from the issue within the automation.
Let me know if this works for you.
Hi Shankara,
welcome to community
with automation this a bit tricky you can try below
attachments is not empty
You can try something on these lines maybe create two different automation and have the second automation run on the first one
But the best way here is as Mohan suggested to check the file size and delete attachments from there.
As running this for all projects would also exhaust the automation limit
Thank You,
Prachi
Hi @shankara vijayendran
I trust that you'll find an Automation-based solution based on the previous comments!
Just as food for thought: If you're open to solutions from the Atlassian Marketplace, you might want to have a look at the app that my team and I are working on: JXL for Jira.
JXL is a full-fledged spreadsheet/table view for your issues that allows viewing, inline-editing, sorting, and filtering by all your issue fields, much like you’d do in e.g. Excel or Google Sheets. It also comes with a long list of so-called smart columns that aren’t natively available, including he attachments size, the number of attachments, and several more attachments-related columns.
This is how it looks in action:
As you can see above, you can easily sort and filter by your smart columns. You can also use them across JXL's advanced features, such as support for (configurable) issue hierarchies, issue grouping by any issue field(s), sum-ups, or conditional formatting.
This all just works - so there's no scripting or automation whatsoever required.
Any questions just let me know,
Best,
Hannes
It looks like you're new here. Sign in or register to get started.