Jira Automation Rule doubling Linked Issue

Fred Deichler January 27, 2021

Hello,

I'm just starting to get into Jira Automation and I have a rule that creates a "Relates to" Link if another ticket is mentioned in a comment. While reviewing the audit log this morning I noticed that a pair of tickets were linked to each other twice. This is not an ideal behavior, so I was wondering if anyone could help me add some logic to prevent this.

Double Linked Tickets.pngScreen Shot 2021-01-27 at 8.21.32 AM.png

Rule.png

4 answers

1 accepted

2 votes
Answer accepted
Fred Deichler March 1, 2021

Hello All,

I was finally able to figure it out. Here is my overall rule

Screen Shot 2021-03-01 at 9.41.25 AM.png

The change was adding the 2nd comparison after learning more about smartvalues.

MD February 15, 2024

I'm sorry, but the proposed solution does not appear to fully address the outlined issue. There is still a possibility of adding a duplicate ticket from the opposing issue side.

1 vote
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2021

Adding one more conditional before your Link action should do it.

I recommend the "Related Issues Condition" which allows you to test Linked Issues.

In the JQL, use this:

linkedIssue = {{comment.body.match ... }}

Below is a test rule I created to validate this approach:

Screen Shot 2021-01-27 at 8.42.17 AM.png

Fred Deichler January 27, 2021

Good Idea @Mykenna Cepek ,

The challenge is that the related issues condition doesn't use regex 

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2021

Do you get an error when you used your regex in the smart value for the "Matching JQL" field? That would surprise me -- I'd appreciate seeing that error.

My suggestion was to set the "Matching JQL" field for this new condition, for your situation, to be this:

linkedIssue = {{comment.body.match("([A-Z]+-\d+)")}}

My test rule doesn't use it, but I'm proposing the new conditional in your rule would.

This would prevent creating another link (of any link type) to the same issue.

Like MD likes this
Fred Deichler January 27, 2021

Thank You @Mykenna Cepek - I misunderstood the validation message on that condition. I have added it and I'll see how it goes.

I really appreciate you helping me out

Screen Shot 2021-01-27 at 11.21.19 AM.png

0 votes
MD February 16, 2024

@Fred Deichler Hi there! 

I want to express my appreciation for the idea introduced by @Mykenna Cepek ! However, during the implementation, I identified some additional issues causing "some errors" within the automation rule (shown in Rule's Audit log). One of the problems is that when a task key is mentioned in a comment as a smart link, it returns twice within smart-value

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

..it is returned as (KEY-1, KEY-1). This is likely because it takes it from the label first and from the URL afterward.. 

Also, upon further a careful review of the returned JQL error:

((issue in linkedIssues("KEY-1")) AND (linkedissue = KEY-1, KEY-1)) AND (projectType in (software))

..I observed that "linkedissue" is used twice, which, in my opinion, is not quite correct. It was also preventing the addition of another linked issue if at least one (no matter which) is already linked. So I updated it to:

key in ({{comment.body.match("([A-Z]+-\d+)")}})

And it worked out perfectly! It now does not allow a duplicated linked issue to be added and prevents its addition from the opposite ticket (outwardissue or inwardissue).

Hope it helps.

Regards,
MD

jira.png

0 votes
Stuart Capel - London
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2021

Hi @Fred Deichler 

Are you only expecting each ticket to have 1 link - that's easier to work around:

Capture.JPG

Fred Deichler January 27, 2021

@Stuart Capel - London - unfortunately not as we have numerous projects

Suggest an answer

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

Atlassian Community Events