The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira automation - restrict linking issue rule from adding duplicate links

Henry Yei
Contributor
August 25, 2020

Is there a way to add a improve the the linking issue automation to avoid linking again if the issue has already been linked?

 

I tried adding a Related Issues condition, but having trouble coming up with a JQL query/smart value combination that would work. 

 

Basically, if an issue is already a related issue (doesn't matter what type of link), and someone references it again in a comment/description, I don't want to added another link to it. 

This is what I have, and does not work. 

Screen Shot 2020-08-25 at 11.16.16 PM.png

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
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 Champions.
August 26, 2020

Hi @Henry Yei 

How about this approach...

  • If you can extract the issue key you plan to link to with your expression,
  • Store that in a variable with the action Create Variable, such as {{var}}
  • And use an If/Else structure to only add the link when not found using a JQL condition (in the Else clause).  An example JQL might  be:
project = myProject AND issue IN linkedIssues({{var}}, "relates to")

Here is the documentation on Create Variable:

https://support.atlassian.com/jira-software-cloud/docs/automation-actions/

And here is an example of using it within a nested structure, such as a branch:

https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Create-variable-New-component/ba-p/1448118

 

Best regards,

Bill

Henry Yei
Contributor
August 26, 2020

Thanks, that pointed me to the right direction!

After using Create Variable, the JQL below got me there.

If: No Linked issues match

Types: All link typesMatch: issue = {{issue.key}} AND issue IN linkedIssues({{issueToLink}})

Like Bill Sheboy likes this
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events