The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Hide/Show different radio button options

Raj
August 18, 2020

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)

//--------------------------------------------------

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question