You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
So currently I'm using Jira Cloud to set a few screens and my current issue is that even by setting a default value or by making a field required, the "None" option still shows up as being usable (although it makes you change it if you try to continue).
What I currently need is to completely remove the "None" option from both Cascading select field and Single line select fields.
may be it will help
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.component.ComponentAccessor
def optionsManager = ComponentAccessor.getComponent(OptionsManager)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def state =getFieldById("customfield_XXXXX")
def stateValue = state.getValue() as String
def country = getFieldById("customfield_XXX")
def countryValue = country.getValue()
def selectCustomField = customFieldManager.getCustomFieldObjectByName("Country")
def selectConfig = selectCustomField.getRelevantConfig(getIssueContext())
def selectOptions = optionsManager.getOptions(selectConfig)
def selectAvailableOptions1 = selectOptions.findAll { it.value in ["India"]}
def selectAvailableOptions2 = selectOptions.findAll { it.value in ["India", "USA"]}
def selectAvailableOptions3 = selectOptions.findAll { it.value in ["India", "USA", "Australia"]}
// cf.setFieldOptions(selectAvailableOptions)
boolean Country1 = false
boolean Country2 = false
boolean Country3 = false
String[] matches1 = new String[] {"Andhra Pradesh", "Madhya Pradesh", "Karnataka", "Tamil Nadu", "Telangana"};
String[] matches2 = new String[] {"Alaska", "California", "Texas"};
String[] matches3 = new String[] {"New South Wales", "Queensland", "South Australia"};
for (String s : matches1)
{
if (stateValue.contains(s))
{
Country1 = true
}
}
for (String s : matches2)
{
if (stateValue.contains(s))
{
Country2 = true
}
}
for (String s : matches3)
{
if (stateValue.contains(s))
{
Country3 = true
}
}
/*
if (Country1 == true || Country2 == true || Country3 == true ){
//country.setFormValue(['Inida', 'USA', 'Australia'])
country.setFieldOptions(selectOptions.findAll { it.value != -1})
}
*/
if (Country1 != true && Country2 != true && Country3 != true ){
//country.setFormValue(['Inida', 'USA', 'Australia'])
country.setFieldOptions(selectOptions.findAll { it.value in ['India', 'USA', 'Australia']})
}
if (Country1 == true && Country2 == true && Country3 == true ){
//country.setFormValue(['Inida', 'USA', 'Australia'])
country.setFieldOptions(selectOptions.findAll { it.value in ['India', 'USA', 'Australia']})
}
else if (Country1 == true && Country2 == true && Country3 != true){
//country.setFormValue(['Inida', 'USA'])
country.setFieldOptions(selectOptions.findAll { it.value in ['India', 'USA']})
}
else if (Country1 == true && Country2 != true && Country3 == true){
//country.setFormValue(['Inida', 'Australia'])
country.setFieldOptions(selectOptions.findAll { it.value in ['India', 'Australia']})
}
else if (Country1 != true && Country2 == true && Country3 == true){
//country.setFormValue(['USA', 'Australia'])
country.setFieldOptions(selectOptions.findAll { it.value in ['USA', 'Australia']})
}
else if (Country1 == true && Country2 != true && Country3 != true){
//country.setFormValue(['Inida'])
country.setFieldOptions(selectOptions.findAll { it.value in ['India']})
}
else if (Country1 != true && Country2 == true && Country3 != true){
//country.setFormValue(['USA'])
country.setFieldOptions(selectOptions.findAll { it.value in ['USA']})
}
else if (Country1 != true && Country2 != true && Country3 == true){
//country.setFormValue(['Australia'])
country.setFieldOptions(selectOptions.findAll { it.value in ['Australia']})
}
Welcome to the Atlassian Community!
One quick thing - you say "by setting a default value or by making a field required" - that should be an "and", not an "or". If you set a default value and make the field required, none will go away. People will be presented with the defualt pre-selected and no "none" on the list.
However, this does not apply to the second half of a cascading-select list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Nic Brough -Adaptavist- My bad there, but I've tried doing both one by one and doing both at the same time. the field None is still there, not selected, but can be clicked on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, if for a select list, you have set a default, and made the field mandatory, then "none" will only be on the list if you have added an option called "none". Check the list of options for the field, you'll find None is an option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ivan.lose and welcome to the community,
Usually select fields comes with the None options. To overcome this problem a solution would be to make this field required within the field configuration. I would pay extra attention before configuring this, and make sure that the field configuration is not shared and/or the modification you'll make, will not affect other projects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Alex Koxaras _Relational_ and thanks for the warm welcome
But as I've mentioned before, I've tried making it required, and it still shows None as an option. It won't allow you to go through with the ticket without completing it, unless this is the second field on a cascading one, which has been pretty much my issue as well.
I've been told that groovy script runner is the way to go, but almost every solution is for Jira Server, and therefore won't work in Cloud.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@ivan.lose my bad! I didn't read carefully :)
However, I did manage to hide the NONE in a single select field and I did exactly what you tried:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
However the above solution doesn't seem to work in cascading fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, the "mandatory" check only checks if the cascading select has any value, which it does if only the first half is set.
There's an open request to get the logic changed to "both parts"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Nic Brough -Adaptavist- it looks like along with the problem of Cascading Fields not forcing the secondary value to be selected (which is a separate issue), it appears that "None" still shows up even if it's required and has a default selected, per JRACLOUD-32463
Description:
Currently, when making a cascading select list which has a default designated a required field, the none option is still present and an acceptable value.
The behavior for this should mimic the select list where the none option is removed once the cascading select is set to required and has a default set.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, that's the one for Cloud, there's another request for server that's older (pre Cloud!) if memory serves.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now, my question comes for both types of drop down lists. AS I want to remove the "none" option from both cascading and single select lists. and making it required and with a default value doesn't seem to be the solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Regarding my cascading select list:
The below JQL will work to find the issues when the child is empty:
project = TEST and "Environment/Test Type[Select List (cascading)]" = is not Empty AND "Environment/Test Type[Select List (cascading)]" not in ("DR (Disaster Recovery) Test", "Performance Test", "Regression Testing", "Security Testing", "Unit Test", "User Acceptance Testing", Integration).
Anyone know of a more concise way to write the bolded part of the JQL that will work? Please keep in mind that None is the Jira Cloud's native default and I don't want to make this field required due to other integrations. I've tried to use is empty, is blank, is null, = none...none of that worked.
If no more eloquent way is available, I can go with what I have.
Thanks Community!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.