Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,301,014
Community Members
 
Community Events
165
Community Groups

Why are my checkbox field options not mutually exclusive?

Edited

After adding Checked and Unchecked options to a custom checkbox field, wondering why the options aren't mutually exclusive, and posting that question to the Community (this post), I realized that the field should not have options.  In a different app, checkboxes are binary fields, but I that is not the case in Jira. 

I switched to a radio button, and added one option, so that the button behaves like a binary checkbox--IF I can hide the built-in None option.  Can that be done?

1 answer

1 accepted

0 votes
Answer accepted

Hi @Phil Bustin 

Would you please clarify what you are asking/observing?  Thanks!

Checkboxes are normally zero-to-many selections, and Radio Button options are one-and-only-one selections, which matches the custom fields that can be added to Jira: https://confluence.atlassian.com/adminjiracloud/custom-fields-types-in-company-managed-projects-972327807.html

For company-managed projects, there is a known problem for custom field, radio buttons which are configured as required with a default value, as they still show a "none" option when they should not: https://jira.atlassian.com/browse/JRACLOUD-75541

Kind regards,
Bill

Thanks, Bill.  I was asking exactly what you addressed.  I found a possible workaround yesterday to hide 'None'.  Here's an extract from it that I saved:

import com.atlassian.jira.component.ComponentAccessor

//Grab appropriate managers
def cfManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()

//Grab form and custom field values
def selectCF = cfManager.getCustomFieldObject("SelectListA")
def selectField = getFieldByName("SelectListA")

//Must grab the relevant config given the current issue context and the custom field
def config = selectCF.getRelevantConfig(getIssueContext())
//Given config, grab a map of the possible options for the select custom field
def options = optionsManager.getOptions(config)

//Define preset multi select options for each single select case
selectField.setFieldOptions(options.collectEntries{[(it.optionId): it.value]})

Of course you'll want to change "SelectListA" in this script to the actual name of your field.

Regards,

Josh

Mattias Kallvi Dec 13, 2018 • edited

Hi Joshua,

Thanks for your script. After a minor change to it (used the field id instead of the field name) it works perfectly. Maybe I have to use id since we have Swedish characters in the field name, not sure. However, this is how thoses lines look now:


//Grab form and custom field values
def selectCF = cfManager.getCustomFieldObject("customfield_12345")
def selectField = getFieldById("customfield_12345")

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

216 views 2 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you