Hi,
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!
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.link.IssueLink
import com.atlassian.jira.issue.link.IssueLinkManager
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())*.issueLinkType.name.contains('Liefertreue KPI')
boolean inward = issueLinkManager.getInwardLinks(issue.getId())*.issueLinkType.name.contains('Liefertreue KPI')
if(checkListValue == "Ja"){
if((outward || inward) && issue.getStatus().getName() == "Closed"{
return true
}else{
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.
Thanks
Rahul
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.