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,557,130
Community Members
 
Community Events
184
Community Groups

Jira Script-runner disablele custom field based on radio value

I have a radio button with value yes, no, two multiline text field A, B. Wonder if I can following:

If radio button value == Yes

A enabled, B will be disabled

If radio button value == No 

A disabled, B will be enabled

 

I am doing this in behavior script

1 answer

1 accepted

1 vote
Answer accepted
Jenna Davis
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.
Aug 28, 2017

You can do something like this:

def radio = getFieldById(getFieldChanged())
def fieldA = getFieldByName("FieldA")
def fieldB = getFieldByName("FieldB")

def selected = radio.getValue() as String

if(selected == null) {
fieldA.setFormValue(null)
fieldA.setHidden(true)
fieldB.setFormValue(null)
fieldB.setHidden(true)
}
if(selected == "A"){
fieldB.setFormValue(null)
fieldB.setHidden(true)
fieldA.setHidden(false)
}
if(selected == "B"){
fieldA.setFormValue(null)
fieldA.setHidden(true)
fieldB.setHidden(false)
}

This will need to be set up on your radio button field. It currently is set up to disable (set hidden and set to null) both fields if 'None' is selected. You can change this by modifying the first 'if' if you'd like. If you need help with this or anything else, let me know. :)

Regards, 

Jenna

Parvaneh Zand
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.
Jul 19, 2020

This was very helpful! Thank you @Jenna Davis 

How can we disable particular custom field instead of hiding that?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events