Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Make checkbox custom field options hide/visible depending on selections made in another field.

Can not edit filters that I own

Erin Blomert
Contributor
January 28, 2021

I have created a bunch of filters for my next-gen projects and dashboards.  When I go to edit them, however, it often only allows me to save as, stating:

"This filter was created by [me]. You can save a copy of this filter but you cannot modify the original."

I am a site admin so I do not think it is a permission issue.  Can someone shed some light?

 

Edit: I do not want to just "save as" the filter under a new name, I want to edit the current one so my dashboard widgets still pull it.

2 answers

0 votes
n
August 9, 2016
Found below is one of the similar issues. But it is for change in Select list field.
I have enclosed a code sample below which shows how you can use the Behaviours plugin provided by script runner to dynamically remove and set from a Select List field based on an option selected inside a check box field.
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()
 
// Get a pointer to my select list field
def selectList = getFieldByName("Demo Select List")
 
// Get a pointer to my check box field
FormField checkBox = getFieldByName("Check Box 1")
 
// Get access to the required custom field and options managers
def customField = customFieldManager.getCustomFieldObject(selectList.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
 
 
// Get the checkbox option value as a String
def checkBoxVal = checkBox.getValue()
 
// Logic to do some actions depending on what check box value is selected
if (checkBoxVal == "A") {
    // define and set the required options when checkbox A is selected
    def optionsMap = options.findAll {
        it.value in ["A""B"// list of options you want to show
    }.collectEntries {
        [
                (it.optionId.toString()): it.value
        ]
    }
    selectList.setFieldOptions(optionsMap)
else if (checkBoxVal == "B") {
    // define and set the required options when checkbox A is selected
    def optionsMap = options.findAll {
        it.value in ["C""D""E"// list of options you want to show
    }.collectEntries {
        [
                (it.optionId.toString()): it.value
        ]
    }
   selectList.setFieldOptions(optionsMap)
}
Would be great if some one can help me with making it able to setFieldOptions for the Checkbox field. 
Thanks.
0 votes
Peter Geshev
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 Champions.
August 3, 2016

As a workaround you can have field 1 and three(one for each option of field 1) other multiple checkbox fields which will be displayed if values a, b and c are selected respectively. 

n
August 9, 2016

Thanks for the response.

 

Well thats a good Idea.

Field1 is having only 3 options in the scene I explained above.

I am working on the checkbox field which has 61 options. So I was trying to use only two fields instead of having individual fields for each option.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events