Get last added attachment to issue using smart values

Antoine [Klee Group] June 20, 2023


Just as in this topic [Automation for Jira] Get last added attachment to... ( I want to access the last attachment added to the issue in order to send its content to another webservice.


My current automation has a trigger of "attachment added", then I capture the attachment.last.content and send it with the "web request" action.


Unfortunately, it seems like the "attachments" array of the issue is not ordered by "creation date" but alphabetically.


How to capture the last attachment added to the issue? this is very troublesome.

1 answer

0 votes
Anthony Morais
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2023

Hi @Antoine [Klee Group] 

In this topic it seems that there is a solution with Scriptrunner.


I hope it helps!




Sidharth verma May 13, 2024

Is their a solution without a scriptrunner or any marketplace app


Antoine [Klee Group] May 14, 2024

@Sidharth verma it's tricky but you need to get the larger attachement ID from the list, because the attachement ID is incremental. Then somehow reconstruct the content URL leading to this attachement. Note that if two attachments are added mostly at the same time, this might not work…

Another "solution" is to use the "webhook" feature from Jira. Triggered on the "attachement created" event. This webhook can then be connected to a Jira automation with the "incoming webhook" trigger. All details regarding the attachment are within the request's body.
Two major dark points regarding this technique is that you kind of need to make an external request (that's not a localhost request) AND the worst one, those webhook do not require any sort of identification so a malicious person could technically send a mockup request to this "incoming webook" Atlassian generated URL.

But it works :)

Suggest an answer

Log in or Sign up to answer