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.IssueTypeManager
import com.atlassian.jira.component.ComponentAccessor
Map validComponentNameByType = ["Task":
["component1","component2"],
"Story":
["component2","component3"]
]
def project = issueContext.projectObject
def issueType = issueContext.issueType.name
def component = getFieldById("components")
if(issueType && validComponentNameByType[issueType]){
def validComponent = project.getComponents().findAll{it.name in validComponentNameByType[issueType]}
component.setFieldOptions(validComponent)
}
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.