Use Jira Automation to get the attachment from a comment.

Bernhard Mostrey
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!
January 24, 2025

When a user posts a comment with an attachment, I would like to use Jira Automation to extract the attachment and send it to the customer's Topdesk instance via REST or Email.

I can get the text just fine, but have been unable to get the attachment from the comment.

Context: Sync between Jira and Topdesk issues.

1 answer

0 votes
Bill Sheboy
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.
January 24, 2025

Hi @Bernhard Mostrey -- Welcome to the Atlassian Community!

For a question like this, context is important for the community to help.  Please post the following:

* an image of your complete automation rule,
* images of any relevant actions / conditions / branches,
* an image of the audit log details showing the rule execution, and
* explain what is not working as expected.

Until we see those...

The scenario you describe is challenging for several reasons, including:

  1. When Jira adds an attachment, it can be accessed from Jira or using a direct URL to the content by logged in Jira users. However, the attachment cannot be sent attached to an external email with an automation rule.  There may be marketplace apps to help do that.
  2. When attachments are added, that takes time to store.  And, the added attachment's URL is not available in the comment body which is available to automation rules.  Specifically, the attachment is added before the comment is added, and possibly, several seconds later.

Again, please check the marketplace for solutions for #1 above.

A potential workaround for #2 is to get the attachment's URL by checking the created date / time of the attachment within a threshold of time, and then sending that URL in the email.

For example, this expression will return any attachments added within the last 5 seconds (and so likely when the comment was added).  Please adjust the 5 second threshold to meet your needs.

{{#issue.attachment}} {{#if(created.diff(now).seconds.lt(5))}}{{content}} -- {{filename}}; {{/}} {{/}}

How that works:

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events