We have a custom radio button field called 'Account Type'. For most reques types, we want to display options A, B, C ,D and E, but for few request types, we only want to show options A and E.
I have used below code but that did not work. Any help would be much appreciated.
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def Actype = getFieldById("customfield_14562")
// Get access to the required custom field and options managers
def customField = customFieldManager.getCustomFieldObject(Actype.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsMap = options.findAll {
it.value in ["A","E"] // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
Actype.setFieldOptions(optionsMap)
//--------------------------------------------------
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.