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:
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
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 )
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 )
hello from the future!
Just want to say this script has saved me so much headache! This works on Behaviors and I thank you very very much!
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