JIRA Comments: Find reference to File attached in a comment.

Shivashankar Boloor Prakash April 3, 2018

Hi,

I'm trying to get reference or copy the file attached in a comment of an Issue.  

As of now I'm able to get List of Collection<Attachment> from the Issue. Im unable to get reference to which comment that particular file was was attached.

Is there any other way to accomplish this.? 

 

2 answers

1 accepted

1 vote
Answer accepted
Ivan Tovbin
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.
April 6, 2018

I'm afraid there's no connection between an attachment and a comment.

However I see two potential workarounds:

1) Check the body of each comment for the attachment name

OR

2) Scan issue history for the time when your attachment was added. Then check the creation time of your comments and see if you'll find a match.

0 votes
Sudhakar Jothilingam
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!
April 3, 2019

1) In body of api response, no longer has the attachment name in it. Seems this is handled in editor differently 

2) Scanning through history matching time stamp is not valid approach

  2.a) When we paste / upload  image it is uploaded to attachments collections first, then if user saves comment few minutes later, the timestamp is completely different

  2.b) What if I edit comment and insert image from attachments?

 

Would appreciate if there is any other solution on this!!

 

 


"body":{
"version":1,
"type":"doc",
"content":[
{
"type":"paragraph",
"content":[
{
"type":"text",
"text":"test2"
}
]
},
{
"type":"mediaSingle",
"attrs":{
"layout":"center"
},
"content":[
{
"type":"media",
"attrs":{
"id":"196e3404-817c-4ea7-897f-5df579710287",
"type":"file",
"collection":"jira-25169-comment-23180",
"width":200,
"height":183
}
}
]
},
{

Vadym Kvasha
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!
April 25, 2024

Have you found any solution? Also, I tried to trigger an automation rule with "issue field value changed" and selected field "Attachment", so if that attachment is counted as the last I would able to access it with attachment.last smart value. But if you add and attachment with a comment (via customer portal) it does not trigger that rule(

Suggest an answer

Log in or Sign up to answer