Created
September 13, 2016 19:48
-
-
Save jechlin/f951aff26dd83197cba1e88b66683a6d 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 | |
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