Link JIRA tickets when they are mentioned in comment

Neetu Verma May 31, 2020

Hi,

I would like a way preferable via automation for jira that anytime a ticket is mentioned in JIRA it would automatically link it in JIRA.

is it possible?

2 answers

0 votes
Rodolfo Romero - Adaptavist October 19, 2022

So, I was able to make this work. A few considerations.

  • I had to create 2 rules. One for when a new comment is created and another one for when a comment is edited.
  • I've added a condition to only execute the rule if the content of the comment contains an issue key. This is using the "Advanced compare condition" using the "contains regular expression" condition.
  • The last line prints the content of the match to the Log so we can verify what was linked for troubleshooting purposes.

Screenshot attached.

2022-10-19_11-01-57.png2022-10-19_11-02-55.png

0 votes
Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 31, 2020

Hi @Neetu Verma

Can I confirm what you mean by link in Jira?

When you mention a specific issue key (eg. ABC-123) in Jira, it should already create a link to that ticket.

If that isn't working, let us know - along with the hosting type for your instance (eg. Cloud, Data Center, etc).

Ste

Neetu Verma May 31, 2020

Thanks for your response, but yes when I mention a ticket in JIRA comments it actually doesn't link two tickets automatically. 

Hosting: Cloud

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 31, 2020

Hi @Neetu Verma 

So you mean when an issue key is commented, you want it to automatically create an issue link between the key commented and the key the comment is applied to?

That could be quite difficult; what is the use case for this?

Ste

Neetu Verma June 1, 2020

Thanks, yes that is exactly what I would want.  We have team members who are commenting on tickets especially if an issue is caused by a fix on another ticket.

We have to always manually link them, and I was hoping to find a way that when developers add a comment and enter a ticket number it would automatically create a link for these two tickets. 

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 2, 2020

Hi @Neetu Verma 

Turns out it's not actually that difficult after all!

To do this:

  1. Go to Automation for Jira and create a new rule
  2. Select the trigger "Issue Commented"
  3. Select the Action "Link Issues"
  4. For This Issue, select what link type you'd like to use
  5. Next in issue value, type in the smart value: 

    {{comment.body.match(“([A-Z]+-\d)”)}}

  6. Give the rule a name and publish it

This will locate each mentioned issue key in a comment and link it to the issue it was commented on.

You can specify a specific project if you prefer - so your smart value would be: {{comment.body.match(“(ABC-\d)”)}} where ABC is your project key.

In case it's not clear, the slash before the d is this character - /.

Ste

Amanda Ward January 5, 2021

I have been trying this but it doesn't seem to be working for me. Audit Log just keeps failing. 

 

Failed to get value for comment.body.match(“([A-Z]+-\d)”): {{comment.body.match(“([A-Z]+-\d)”)}}

 

I tried: 

{{comment.body.match(“(\w+-\d)”)}} and that works only if the project is in capitals, not sure why your verison didnt work. 

 

but the same concept wont work for the description field. 

Rodolfo Romero - Adaptavist October 18, 2022

@Stephen Wright _Elabor8_ , @Amanda Ward  I tried to used any of the options mentioned above and I get the following error:

Error rendering smart-values when executing this rule: Failed to get value for comment.body.match(“(\w+-\d)”): {{comment.body.match(“(\w+-\d)”)}}

Here is a screenshot of my automation rule.

 2022-10-18_15-34-30.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events