Hello,
I would like to create an automation rule, that would run when a comment is added with attachment, and create an issue with the comment-attachment added to the issue.
Is there a way to do this with Jira Automation? I couldn't find a condition that checks whether the added comment has an attachment or not. And for creating an issue, I don't know how to add ONLY the attachment that was added in the comment to the created issue.
Any help is appreciated :)
Cheers, pj
After some trial and error, I've found that the following automation structure seems to achieve the goal of detecting if an attachment is contained within a comment. The only caveat is the "regular expression" portion of the condition must include the attached filetype in the regex query, otherwise the automation fails to trigger.
Trigger:
Condition:
For myself, I found a solution:
If some file is not displayed, then use {{issue.comments.body}} after you have loaded this file in the comment to see what distinctive words or characters the file contains
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Uladzislau Samuseu have you figured out the smart value for the attachment in the last comment?
What I've noticed is that when I refer to the {{issue.comments.last.body}} then I get the body of the actual last comment added, but it's only the name of the attachment in text form.
By contrast, {{issue.attachment.last.content}} doesn't give me the last added attachment, but the last attachment of all attachments from the issue and they're sorted by NAME, not by DATE. So if my attachment starting with Z was added 3 comments ago and now I'm adding an attachment with B, this smart value still gives me attachment with Z.
Maybe you know how to handle this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Karolina Dylewicz, If I understand the logic of your rule correctly, then most likely these ideas will help you:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks!
I'll try this, just bear in mind that we're talking about DC, not Cloud. Though this article was for Cloud.
The first logic in my previous tests didn't react to comments added from the portal. I'll check again with your exact config.
:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Uladzislau Samuseu , so I've been checking this and this {{issue.attachment.content}} prints all attachments present on the trigger issue, not only the one added as last :(
and the second option does't work for comments added via portal.
have you got any other ideas? especially some smart values for issue.comments.last.body/attachment.filename. etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thease work correctly for me in Cloud version (I haven't encountered the desktop version)
In case with comments try to use "comment" instead of "comments".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Puján Z
First of all: What is the use case behind this requirement? Why would you like to copy an attachment (that is obviously meant to be part of an issue) to another issue?
As far as my knowledge reaches there is no condition to grab an attachment of a comment and furthermore hand it over to another issue.
I can´t tell 100% sure but I can imagine that Rest API calls could maybe handle this problem. So you could try to add a "send webrequest" action in your rule to grab the attachment.
Furthermore: What do you mean with "ONLY" adding the attachment? When creating an issue at least the summary field is required.
Best
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
We use Jira as a comprehensive ERP system. Probably the first one in the world to do so, and the landscape and interplay of apps in pretty complex. So a lot of things we do is not common practice ;)
If you have to know the requirement in order to come up with a workaround: we are connecting Jira to an AI-System to read and categorize attachments automatically. That is why every attachment is handed over to an "attachment handling" issue, in which they are analyzed, categorized, and the extracted attributes are verified and delivered to the target issue.
For this, when an email with an attachment is sent to and captured by Jira, this attachment (and only this one, and not the already existing attachments) needs to be sent to our AI-system vai API or email. I was trying to do this with Automation, but it seems it is not possible. And considering Atlassian's response time in developing new features, we now need to look for another solution to get the attachment it seems.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As i mentioned in my post before there are other ways in between „automation for jira“ amd „waiting for new features“.
As you explained what you are trying to do i assume you are not a tech newby so I would suggest to check out the API documentation.
Furthermore:
Do you have scriptrunner plugin installed?
Best
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.