Simple scripted validator for inward link

Hi,

using JIRA 6.3.13 and Scriptrunner 3.1.4 I'd like to add a simple scripted validator doing the following:

If there are incoming links of linktype "Teilprojekt" the linked issue(s) must NOT be "Open" for carrying out the transition. Link discription for incoming link is "is Teilprojekt of".

Very important: the validator should only check incomming, but not outgoing links.

 

Thank you!

1 answer

0 vote
Jenna Davis Community Champion Sep 08, 2017

Hello, 

I think that something like this will work for you:

import com.atlassian.jira.component.ComponentAccessor

def issueLinkManager = ComponentAccessor.issueLinkManager
def inwardLinks = issueLinkManager.getInwardLinks(issue.id)

inwardLinks.each {
if (it.issueLinkType.name == "Teilprojekt") {
if ((it.sourceObject.status as String) == 'Open') {
return false
}
}
else return true
}

I did not test out the code directly, but I believe it should work. If something isn't working out please do not hestitate to come back and ask. :)

Regards, 
Jenna

Hi Jenna,

thank you very much for looking into this one. But I am sorry. It is not working. The transition is not blocked.

Jenna Davis Community Champion Sep 20, 2017

Sorry for my belated reply!

Were you able to get this to work? If not, do you see any errors?

Regards, Jenna

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
Published Apr 19, 2018 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...

366 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