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,415,589
Community Members
 
Community Events
170
Community Groups

In Jira how to control the values of a multi select field based on value selected on another field

I have requirement, request your help here:

I have two custom fields ApplicationName (single select) & Componentname (multi select).  Now based on the value selected in Application field values of Component field should change.

With the help of this post, thanks for this post - https://community.atlassian.com/t5/Marketplace-Apps-questions/Show-Hide-options-from-cascading-select-list/qaq-p/260685

I am able to come up with the below script which works perfectly but I need to select any value in the "Component" field for the changes to reflect.  Is there a way when the Application field is selected and Component field updates automatically without being selecting a value in Component field?

Thanks in advance.

 

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor

def appField = getFieldByName("ApplicationName")
def selectList = getFieldByName("ComponentName")

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()

def customField = customFieldManager.getCustomFieldObject(selectList.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)

def appselectedOption= appField.getValue() as String

if(appselectedOption.contains("App")){
def optionsMap = options.findAll {
it.value in ["UI", "Web"] // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
selectList.setFieldOptions(optionsMap)
}
else if(appselectedOption.contains("DB")){
def optionsMap1 = options.findAll {
it.value in ["Oracle", "SQL"] // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
selectList.setFieldOptions(optionsMap1)
}

 

0 answers

Suggest an answer

Log in or Sign up to answer