Script Validator: Linked Issue required in certain Status


again I have a Scriptrunner Question.

JIRA 6.3 (I think this is important, scince there are diffrences between 6.x and 7.x)
Scriptrunner 3.1.4

There is a checklist 'Liefertreuerelevanz'. If the user chose option 'Ja', there must be exactly one linked issue of issuetype 'Liefertreue KPI' in Status 'Closed' to carry out the transition.

Thanks for your help!

1 answer

Hi David,


You can try below script by configuring scripted validator on the transition.

import com.atlassian.jira.component.ComponentAccessor 
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue;
import com.opensymphony.workflow.InvalidInputException;

Issue issue = issue String resolution = issue.getResolution().getName()
IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager()
CustomFieldManager cfm = ComponentAccessor.getCustomFieldManager()
CsutomField liefertreuerelevanz = cfm.getCustomFieldByName("CUSTOMFIELD_NAME")
String checkListValue = liefertreuerelevanz.getValue(issue).toString()
boolean outward = issueLinkManager.getOutwardLinks(issue.getId())*'Liefertreue KPI')
boolean inward = issueLinkManager.getInwardLinks(issue.getId())*'Liefertreue KPI')

if(checkListValue == "Ja"){
if((outward || inward) && issue.getStatus().getName() == "Closed"{
return true
throw new InvalidInputException("Can not execute transition when status is Closed linked issue isn't Liefertreue KPI")

Let me know if you face any issue.




Hi Rahul,

Thank you very much. But unfortunatly the validator doesn't work. I tried this in a ticket with liefertreuerelevanz = Ja but with no linked issue. The transition was carried out.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,717 views 3 11
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