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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,644,554
Community Members
 
Community Events
196
Community Groups

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 :) 

3 answers

You have idea ?

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

0 votes
Radek Dostál
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 Leaders.
Dec 23, 2021

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events