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

Need only selected values if some value for a custom field is selected

I have 2 fields( select list single choice ) named A and B .
A and B contains so many values as well .
My request is if A field is selected with a value XM then the field B should shows only some selected values ( not all values ).
How can I acheive this ?

1 answer

1 accepted

1 vote
Answer accepted
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 10, 2022

Hi @Aswathi D 

You can do it by creating a Behaviour that is part of Scriptrunner app.

https://scriptrunner.adaptavist.com/6.20.0/jira/behaviours-overview.html

 

Regards

Hi @Florian Bonniec ,

Is it possible to show an example behaviour for this case ?

Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 11, 2022

Hi @Aswathi D please find below an example.

import com.atlassian.jira.component.ComponentAccessor

import com.onresolve.jira.groovy.user.FieldBehaviours

import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

final singleSelectListName = 'Select List'

def radioButton = getFieldById(getFieldChanged())

def allowedValues

if(radioButton.getValue() == 'A'){

    allowedValues = ['1', '2']

}

if(radioButton.getValue() == 'B'){

    allowedValues = ['3']

}

if(allowedValues){

    // Getting select field options

    def selectCustomField = customFieldManager.customFieldObjects.findByName(singleSelectListName)

    def selectConfig = selectCustomField.getRelevantConfig(issueContext)

    def selectOptions = ComponentAccessor.optionsManager.getOptions(selectConfig)

    // Filter select available options

    final selectAvailableOptions = selectOptions.findAll { it.value in allowedValues }

    getFieldByName(singleSelectListName).setFieldOptions(selectAvailableOptions)

}

In this example I have a Radio Button with value A or B

A select list with value 1, 2, 3.
When A is selected I Ihave only 1, 2 available, when B I have 3.
This script is added a script server side for the radio button.
behaviour.PNG
Regards

Hello,

I have a more or less similar request.

I need to restrict the displayed values of a field. However, there is a difference. I don't have another defining field. Instead, I need to restrict the field values to "A" and "B" only on a transition screen.

Unfortunatelly I don't have scripting skills. Can someone please help with this?

Big thanks in advance!

Best regards,
André

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events