Created
December 29, 2014 19:03
-
-
Save jechlin/d9b8e778041c02e04270 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
def customFieldManager = ComponentAccessor.getCustomFieldManager() | |
def optionsManager = ComponentAccessor.getOptionsManager() | |
def formField = getFieldByName("SelectListA") // *name* of your custom field | |
def customField = customFieldManager.getCustomFieldObject(formField.getFieldId()) | |
def config = customField.getRelevantConfig(getIssueContext()) | |
def options = optionsManager.getOptions(config) | |
def optionsMap = options.findAll { | |
it.value in ["AAA", "BBB"] // list of options you want to show | |
}.collectEntries { | |
[ | |
(it.optionId.toString()) : it.value | |
] | |
} | |
// or to show the first 12 options | |
//def optionsMap = options.take(12).collectEntries { | |
// [ | |
// (it.optionId.toString()) : it.value | |
// ] | |
//} | |
formField.setFieldOptions(optionsMap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks man!