Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

Remove option "None" without requiring the field Edited

Hi, I need to remove the option None everytime I create select lists or radio buttons. I know it can be done through making it required but it affects the whole creation of issues. It is because during creation of issues, my select lists are not yet in the create issue screen therefore I can't proceed to make such.

I found out that it could be achieved without making the field to required if I'll edit the file "edit-select.vm" (C:\Program Files\Atlassian\JIRA\atlassian-jira\WEB-INF\classes\templates\plugins\fields\edit) by this link: 

https://confluence.atlassian.com/jirakb/how-to-remove-none-from-a-select-list-custom-field-144212308.html

however, this solution isn't updated for the current JIRA. By the way I am running the latest version of server (7.9.2) 

Thank you for your time

5 comments

Hi @Franco C. A.

You can use the following javascript to remove the "None" option.

  • Go to Field Config
  • Edit the CF
  • Paste the code
<script type="text/javascript">
AJS.$(function() {
var cfList = document.getElementById('customfield_xxxxx')
cfList.remove(0)
});
</script>

ps: It is also possible to do it via Script Runner (Behaviours) add-on.

Tansu Akdeniz

Like Deepali Bagul likes this

Hi @Tansu AkdenizAkdeniz,

Can you please guide how we can do it using script runner.

Thanks,
Raj

Why bother?

If you remove "none", you're telling the user that they cannot leave the field empty.  Which is the same as making it mandatory.

if it's a shared field configuration scheme, you'll need to create another field configuration scheme just for that project. If you have hundreds of projects, you don't want to be creating a field configuration scheme for each of them, with every project has different requirement towards different fields. 

Unless you have a workaround?

It's very confusing. Agree with @Azfar Masut. I just need one mandatory field in only one screen. I make it required, affect all process. Even for project creation it becomes required field. I don't want to create another field configuration scheme. I didn't added this field to create screen. 

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 )
Like # people like this

where did you write this script .?

@Todd Lindsey Behavior Script Section in Scriptrunner

That doesnt work.

I did the changes for my problem but I see the "None" Option in every Screen:

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

def dauer = getFieldByName("dauer")
dauer.setAllowInlineEdit(false)

def dauerCustomField = customFieldManager.getCustomFieldObject(dauer.getFieldId())
def dauerConfig = dauerCustomField.getRelevantConfig(getIssueContext())
def dauerOptionsOriginal = optionsManager.getOptions(dauerConfig)

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

dauer.setFieldOptions( dauerOptionsCustYes )

I tried pasting this in the configuration of the field the option remained after i re-index, can't get it to remove and don't have scriptrunner

Is there any alternative for removing the None option, other than using script ?

Make the field mandatory?  As you don't want "none" to be selectable, your people will have to put something into it

Comment

Log in or Sign up to comment
TAGS

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