Possible to remove 'none' in custom field list?

Build Monkey June 4, 2012

I created a custom field that is a drop down list and noticed that it contains the value 'None'. I do not want this in the list, but rather only use the values I created in the drop down list. Is this possible?

Thanks

9 answers

9 votes
Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012

You have to make the field required, then the 'none' won't be there anymore.

pengpeng October 16, 2019

No, it is still there after I make it required in field configuration

Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2019

See my answer from 2019 - you also have to define a default value.

Like Eric Dreyer likes this
8 votes
Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 13, 2019

At the moment (in Jira 7 and 8) you have to make the field mandatory and give it a default value - then the "None" disappears. 

4 votes
Azfar Masut
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 4, 2019

Using scriptrunner behavior, you can use something like below. 

Set the field as required/not required (on behavior side, not JIRA's field configuration), depending on your use case.

In my case, I want my severity field to be set as required only on a certain project, without having to create additional field configuration (as I have one massively shared field configuration - for process standard in my company). So I set the severity field as required through behavior, but the 'none' option stills show. So, use below :script 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
def optionsManager = ComponentAccessor.getComponent(OptionsManager)

def severity = getFieldByName("Severity")
severity.setAllowInlineEdit(false)

def sevcustomField = customFieldManager.getCustomFieldObject(severity.getFieldId())
def sevconfig = sevcustomField.getRelevantConfig(getIssueContext())
def sevOptionsOriginal = optionsManager.getOptions(sevconfig)

/*define the select list manually, do not include the 'none'*/
def sevOptionsCustYes = sevOptionsOriginal.findAll { it.value in ['Critical', 'Serious','Medium','Low'] }

severity.setFieldOptions( sevOptionsCustYes )
Liam Maeder July 8, 2019

Thanks @Azfar Masut

We don't have Script Runner on our server, but I can try and persuade our board to invest in it. But when I tested on my own personal instance it seemed to do the trick.

Regards

Like Azfar Masut likes this
Azfar Masut
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2019

@Liam Maeder - great to hear that! Do help to upvote my answer if it helps!

btw, scriptrunner is worth the investment, especially if you're supporting large number of users (in my case, 10k userbase). Lots of other customization can be done with SR to deal with the small custom request from your users. I would say, go for it!

Keerthana Sundaram December 2, 2019

The behavior script worked perfectly fine.

Thanks @Azfar Masut .

Like Azfar Masut likes this
Sujitha September 22, 2020

The behavior script was very useful and it worked fine.

Thanks @Azfar

Like Azfar Masut likes this
Kevin October 4, 2022

Hello @Azfar Masut ,

 

This solution seems to be the one that I need, but I have a question. You state that I need to set the field as required in behavior. I'm not sure how to do that, I know about the field config setting required, but not about "behavior." Can you point me in the right direction please?

Set the field as required/not required (on behavior side, not JIRA's field configuration)

Azfar Masut
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 14, 2022

@Kevin Middleton sorry for being unclear on that part. Setting required/not is optional depending to your use case. The point is, for that config,  instead of using field configuration to control either a field is required or not, use behavior instead. For behaviour, see https://docs.adaptavist.com/sr4js/latest/features/behaviours/behaviours-tutorial . You'll require scriptrunner add-on for this

3 votes
Amit Bhatt May 28, 2013

A dirty workaround - Make the custom field Mandatory and "None" option will disappear.

1 vote
simarpreet singh June 5, 2020

Only solution (without any coding) is to:

  • first make the field mandatory
  • Then, set a default value for that field 
0 votes
Mason Crouse May 24, 2021

You can also add an option that's just a space and make that the default value. Of course, you still need to make the field mandatory

0 votes
Lakkumanan Lakshmanan March 7, 2021

Step one: Make the custom field not "Multi-select value" meaning, "None" in that selection as part of edit the custom field.

Step two: Make the field mandatory/required

This works for me

0 votes
Raj Kumar July 12, 2019

@Azfar MasutMasut,

 

I am using the below code to display options of the Location field but I see none option by default on the request form but I do not want that instead, I want International to show up. Can you please help.

 

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 Location = getFieldById("customfield_14444")
Location.setAllowInlineEdit(false)

// Get access to the required custom field and options managers
def customField = customFieldManager.getCustomFieldObject(Location.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsMap = options.findAll {
it.value in ["International",
"United States"] // list of options you want to show
}
Location.setFieldOptions(optionsMap)

Azfar Masut
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 12, 2019
looks correct to me, can you double check and ensure the location field doesnt have 'none' set as default? (from the JIRA custom field setup page)
Raj Kumar July 12, 2019

I am sure no default value is set. 

Azfar Masut
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2019

Try setting International as default instead. Is the 'None' option still showing after that?

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012
Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012

Hi Jobin ,

Do you know what will be a javascript/groovy solution for making "None" as the first option . I have raised a question here

Thank you

Liam Maeder September 18, 2018

I have a similar issue where i keep getting this none option but i have a default value already set and mandatory, yet the none option is still present. Is there no there way to get rid of it

Like # people like this
Wade Sturman December 13, 2018

I'm having the same issue as @Liam Maeder. The Field is required, but none still shows up; what's worse, it acknowledges 'none' as acceptable, so it basically renders the 'required' part of the field useless.

Like # people like this
Umer Arif February 28, 2019

I am having the same issue. What is the point of making a field required if none will be an option? Is this a bug? 

Like # people like this

Suggest an answer

Log in or Sign up to answer