I have a JIRA project with 15 components and 4 issue types. Would like to limit the component choices based on issue type using ScriptRunner Behaviors. Can anyone help me with a shell script to get me started?
JIRA 7.6.1
Scriptrunner: 5.2.2
Hi, Aaron, something like this should help you start
import com.atlassian.jira.config.IssueTypeManagerimport com.atlassian.jira.component.ComponentAccessorMap validComponentNameByType = ["Task": ["component1","component2"], "Story": ["component2","component3"] ]def project = issueContext.projectObjectdef issueType = issueContext.issueType.namedef component = getFieldById("components")if(issueType && validComponentNameByType[issueType]){ def validComponent = project.getComponents().findAll{it.name in validComponentNameByType[issueType]} component.setFieldOptions(validComponent)}
@Michel Tremblay [Adaptavist]
Hi Michel,
Thanks for your great answer.
I need to restrict component/s based on request type on customer portal.
Could you please help me to solve it?
It looks like you're new here. Sign in or register to get started.