Created
September 13, 2016 19:48
Star
You must be signed in to star a gist
This file contains 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 | |
import com.atlassian.jira.issue.customfields.manager.OptionsManager | |
import com.atlassian.jira.issue.customfields.option.Option | |
def optionsManager = ComponentAccessor.getComponent(OptionsManager) | |
def customFieldManager = ComponentAccessor.getCustomFieldManager() | |
def cf = customFieldManager.getCustomFieldObjectByName("CascadingSelect") // <- change name of field | |
Closure formatOption | |
def sb = new StringBuilder() | |
formatOption = { int depth, Option option -> | |
sb << (("\t" * depth) + option.value + "\n") | |
depth++ | |
option.childOptions.each { | |
formatOption(depth, it) | |
} | |
} | |
cf.getConfigurationSchemes().each { fieldConfigScheme -> | |
def fieldConfig = fieldConfigScheme.getOneAndOnlyConfig() | |
sb << "Options for ${fieldConfigScheme.name}\n\n" | |
optionsManager.getOptions(fieldConfig).each { | |
formatOption(0, it) | |
} | |
} | |
"<pre>" + sb.toString() + "</pre>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment