Automatically link tickets by a issue comment

This workaround is meant to help JSM, JSW and JWM projects where it is necessary to link Issues mentioned in a comment.

At the moment, this functionality isn't available natively in Jira, we have a request feature created for this topic:

Workaround steps:

  • Automation rule:
    • First, it will be necessary to create an Advanced compare condition for the comment with the desired project Key, with this smart value{{issue.comment.last.body.text}}Screen Shot 2022-10-10 at 17.33.59.png
    • It will be necessary to create a variable, "test" for example with this smart value and regex validator{{comment.body.match("([A-Z]{2,}-\d+).*")}}Screen Shot 2022-10-10 at 17.35.09.png
       Note:
      I recommend not using a variable name with any word that could be related to some Jira property, as this will make automation not work (I found this out by doing several tests using the word "issue" until I used the word "test" which worked).
    • So the icing on the cake here is to add a Link issues action into the automation rule using the variable that we already create with this smart value: {{variable_name}}Screen Shot 2022-10-10 at 17.36.38.png
    •  Extra tip: if you want to link tickets from different projects by a comment, just change the scope of the automation rule to Global(All projects for Multi projects):Screen Shot 2022-10-10 at 18.06.02.png

Now the ticket mentioned in a comment will be automatically linked. The automation rule will work as in the screen recording below:

12 comments

Bhanu
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.
October 10, 2022

This looks like a great feature to have. It reduces an extra step to link the issue manually. Thank you for sharing this @Bruno Altenhofen

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 10, 2022

Hey @Bhanu

Thank you for your feedback! :D

Like Hasini Katta likes this
Charles Trilha
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 11, 2022

Very nice article!

Like Bruno Altenhofen likes this
Rick Toffoli October 11, 2022

Amazing! This feature will help a lot our Jira site.
Thank you for share @Bruno Altenhofen 

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 11, 2022

Hey @Rick Toffoli 

Thank you for your feedback! :D

David Berclaz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2022

I just configured it for our Customer Portal, and I can confirm it works perfectly!
Thanks for the workaround @Bruno Altenhofen 💪

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 17, 2022

Hello @David Berclaz 

Great! Thanks for your feedback! ;)

Like David Berclaz likes this
Yatish Madhav
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.
October 26, 2022

Super! Thanks for this @Bruno Altenhofen  - I have extended the variable to this:

{{comment.body.match("([A-Z0-9]{2,15}-\d+).*")}}

To allow for numbers in the Project keys and we also have our Jira instances project keys limit set to 15.

Thanks for this. It works great!

Now to implement it across our 700+ projects if everyone is happy with this :D

Thank you

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 21, 2022

Hey @Yatish Madhav 

Thank you for your feedback! :D

Lauren Strom February 28, 2023

this works beautifully if you only mention one ticket! what if you're mentioning multiple tickets in one comment?

i.e. your comment is: "following up for feedback on FORM-1 and AFJ-1"  ? 

or 

i.e. your comment is: "following up for feedback on AFJ-1 and AFJ-2"  ? 

tk June 2, 2023

thanks for the doc.

I can't believe this is not available native (jira server had this forever and it also removes the link when comment is deleted or updated)

Mark June 16, 2023

@Lauren Strom this works fine in my case assuming XXX in my project prefix. This works for tickets mentioned after each other or on new lines. 

{{comment.body.match("(XXX-\d+)")}}

I have added 4 automation rules: ticket created, ticket updated, comment added, comment updated. 

Comment

  1. Trigger: Comment Created or Updated
  2. Not sure if necessary: but with regex: {{comment.body}} contains regular expression `XXX-\d+`
  3. Create Variable: {{ticketNumber}} with smart Value `{{comment.body.match("(XXX-\d+)")}}`
  4. Link Issue To: Relates to `{{ticketNumber}}` 


Issue 

  1. Trigger: Issue Created or Updated
  2. Not sure if necessary: but with regex: {{issue.description}} contains regular expression `XXX-\d+`
  3. Create Variable: {{ticketNumber}} with smart Value `{{issue.description.match("(XXX-\d+)")}}`
  4. Link Issue To: Relates to `{{ticketNumber}}` 

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events