Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Updating list

Edited

Hello everyone 

This code it's functionnally : 

import com.atlassian.jira.component.ComponentAccessor

def singleSelect = getFieldById(fieldChanged)


def
 multiSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("CustomFieldB")
def msConfig = customField.getRelevantConfig(issueContext)
def msOptions = ComponentAccessor.optionsManager.getOptions(msConfig)

def filteredOptions = msOptions

switch (singleSelect.value) {
    case "1":
        filteredOptions = msOptions.findAll {it.value in ['A', 'B', 'C']}
        break

    case "2":
        filteredOptions = msOptions.findAll {it.value in ['D', 'E', 'F']}
        break
}

formField.setFieldOptions(filteredOptions)

But i would like when i clik in case "1" and after i click in case "2" the list does not updated 

exists a function for updating list or ohter , beacuse im need this functionnallity for continue the project

 

Thanks in advance :) 

1 comment

As I understand it, you are setting this behaviour for the single select field, hence

def singleSelect = getFieldById(fieldChanged)

 

And then you want to change the options for other field B

def multiSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("CustomFieldB")

 

However, in your snippet, you are setting these values for 'formField':

formField.setFieldOptions(filteredOptions)

 

And this I think should be instead

getFieldByName("CustomFieldB")?.setFieldOptions(filteredOptions)

 

Because formField I assume refers to your single select - which is what the code is attached to.

Yes , but i'm search a function who do update a liste when i change in between case in real time

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

414 views 19 22
Read article

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