How to limit Issue Link Types users can select based on the Issue condition

Hi all, the story is I want to have at maximum one issue which linked with the current issue in type causes.

NOTE: A lot of answers point out the solution for Workflow Validator. But I actually want to apply this to the Add Link button (or from More → Link)

It means, the Issue in the picture below already has a link to ITC-10 with type causes, so I want it to not be able to create more links with type causes, unless you delete the link with ITC-10.
Again: I want to have at maximum just one link with type causes, no more.

Is there any possibility to implement it, even with Script Runner, an app,…?

Hi @nhac.tat.nguyen,
you can probably create a ScriptRunner validator, but I’m no ScriptRunner expert.
Otherwise, you can use a Related Issues Validator from JMWE without any code.


Yep, a ScriptRunner validator is possible, as long as you can use a Jira expression to capture what you want (in this case, check for a specific link name, then restrict if a link of that type exists).

1 Like

Check my plugin Issue Linked Event for Jira | Atlassian Marketplace - gives you ability to validate linked issues.


1 Like

Hi @DaveLiao , the link you sent is for Jira Cloud, do we have a document for Jira Server?

Hi @david2, I have read the Scriptrunner validator, and as I understood so far, it is only the Workflow Validator (used to validate a transition). But in my case, I want to validate when use adding new issue link.

@nhac.tat.nguyen - maybe try a ScriptRunner Behavior to validate the link? Note that Behaviors only work on Create and Edit screens - because of this, if you try to edit a field with a behavior on the View screen, you’ll be sent to the Edit screen.

Hey, ScriptRunner Behavior is not working in the Issue Linking screen (the picture in my post). So I’m finding another solution.

1 Like

Hi @adam.labus, I read the documentation and not sure how to make it work. Could you please give me some sort of support on how to configure it?

Thank you

Hi @nhac.tat.nguyen

Based on your first post:

  1. Go to ILE administration page and set configuration to All validation must by positive
  2. Add new jql filter - Causes is Name from page [URL]/secure/admin/ViewLinkTypes!default.jspa
  • Name: sourceLinkFilter1(Causes)
  • JQL: issueLinkType not in (causes)
  1. Add new jql filter
  • Name: errorLinkFilter1(Causes)
  • JQL: summary ~ "You can’t create more links with type causes"
  1. Go to ILE administration page and check the bottom of the page if you can see the saved filters

Now check your use case from first post, when you try link new issue plugin check jql from filter sourceLinkFilter1(Causes) - issuekey = YOURISSUE and issueLinkType not in (causes)
If this issue is in the jql results, a new link will be created, if not, you will get an error according to the filter errorLinkFilter1(Causes)

Now, according to the documentation, you can extend the validations on both sides (“current issue” = sourceLinkFilterX and linked issues = destLinkFilterX) in any way, describing them with jql

if you want to adapt it to specific projects, statuses, etc. let me know, I will be happy to help you

Adam Labus


Thank @adam.labus, finally I can make it work. Thank you very much!

1 Like