Smart Value: issue.attachment.last.content not grabbing latest attachment.

Edward Yun
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2024

Hello everyone, 

 

I hope everyone is happily debugging/coding. Just as the title states, I am having an issue where my Jira automation that has a Then: Send web request will randomly grab the incorrect attachment where it's manually being triggered. This is currently my custom data that I wish to send.

{
       "tmp": "{{issue.attachment.last.content}}",
}

In some instances, my ticket will grab the latest attachment while in some tickets will not. I've checked the time stamps to make sure that they have different CSVs data, but I can see that if there were 3 CSVs, my automation would grab the CSV second from the last attachment. Any help in the right direction would be most appreciated!

Thank you

1 answer

1 vote
Kalyan Sattaluri
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.
May 21, 2024

Hello @Edward Yun 

{{attachment}} smart value gives you the full list of attachments sorted by Alphabetical order, not by date, so thats what you are seeing.

Only if you are using a trigger = "Field value changed" on Attachments, you can, in a hacky way, recreate the file content/URL like below:  {{baseUrl}}/{{changelog.Attachment.to}}/{{changelog.Attachment.toString}}

But because you are using Manual trigger, I dont know of a way to get that info. Sorry and hope it helps. Thanks!

Edward Yun
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2024

Hi, Kalyan Sattaluri

This is perfect. I had no idea that it was based on alphabetical order and not by the dates. I have a possible solution based on what you have just explained for me.

I appreciate the assistance and can't thank you enough for your insights.

Thank you!

Like # people like this
Kalyan Sattaluri
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.
May 21, 2024

Glad to hear it was useful. Please consider accepting solution if it answers your question so others can benefit, Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events