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
Hi,
I have a script with which i hide some options from select list, and i wont to do same with cascading select list. I try to do it with this script but it does not works
import com.atlassian.jira.component.ComponentAccessor
def supLine = getFieldByName("cascading select")
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def customField = customFieldManager.getCustomFieldObject(supLine.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsMap = options.findAll {
it.value in ["xxx"]
}.collectEntries {
[
(it.optionId.toString()) : it.value
]
}
def parentOption = options.find {it.value == "xxx"}
def childOption = parentOption?.childOptions?.findAll {it.value in "yyy"
}.collectEntries {
[
(it.optionId.toString()) : it.value
]
}
supLine.setFieldOptions(childOption)
supLine.setFieldOptions(optionsMap)
Try to use HashMap
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.impl.CascadingSelectCFType
HashMap<String, Option> hashMapEntries = (HashMap<String, Option>) customFieldValue
Option parent = hashMapEntries.get(CascadingSelectCFType.PARENT_KEY)
Option child = hashMapEntries.get(CascadingSelectCFType.CHILD_KEY)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.