You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.