Adding Validation with issue links

Hey guys,


I have been trying to create some validation based on a custom property drop down and issue links. So far, the custom property portion works fine, but the issue links part never seems to work. I have tried some of the different examples on the wiki without much luck. I am trying to make something similar to the code below.


cfValues['Test dropdown']?.value != "team 1" || (cfValues['Test dropdown']?.value == "team 1" && has at least 1 linked issue))

 The has at least 1 linked issue has not been working for me. I have tried different options such as:

issueLinkingValue.linkedIssues.size() > 0




Anyone have any suggestions on how I can implement the linked issue portion? 

Note: Using a Simple Scripted Validator from the ScriptRunner plugin.



Matthew Shafran

1 answer

1 accepted

Hi Matthew.

For awhile now, links have been divided in two categories.

OutwardLinks, for links that were created from outside the issue.

InwardLinks, for links that were created from inside the issue.

In order to get each you could do this:

import com.atlassian.jira.component.ComponentAccessor

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def inwardLinks = issueLinkManager.getInwardLinks(
def outwardLinks = issueLinkManager.getOutwardLinks(

if(inwardLinks.size() + outwardLinks > 0){
///your code goes here

Hi Daniel,


Thanks, that worked!

Hi Matthew, glad that was the case. 

Would you mind accepting my answer? That way other people know that this is correct by looking at the title, and you won't get annoying emails saying you have unaccepted questions.



Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

356 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you