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
Community Members
Community Events
Community Groups

Show or Hide the custom field based on the radio button option selection



I have a radio button type custom field "Test" with options "Not Started", "Started", "Staged", "Rejected" while creating the issue in Jira.

If option "Started" is selected in the radio options, a custom field named "Flow" need to appear on the create screen, if any other option is selected "Flow" custom field should be hidden.

I tried few behaviors scripts in script runner but none worked, can anyone help on this??


3 answers

1 accepted

0 votes
Answer accepted

Hi @KSKumar55

Your code will not work as expected.

If you want the Behaviour to trigger based on the value of another field, you will need to use the Server-Side Behaviour. The Initialise will not do.

Regarding the radio button's Behaviour, it may be related to the SRJIRA-5699 Bug.

To proceed, please try these steps:-

  1. Temporarily disable your Behaviour.
  2. Next, go to the field configuration page and set your Radio Button fields to required, as shown in the screenshot below:-
  3. Next, re-enable your Behaviour but ensure the required option for your radio button is removed.
  4. Now go to your issue, refresh your browser, try to create an issue and check if the None option is still visible for the Radio Button.
  5. If it does not appear, try to select one of the options on the radio buttons. Then, go back to the Field Configuration and set the Radio Buttons back to optional.
  6. Next, re-enable your Behaviour, set the Optional / Required toggle for your radio button to Required and try to re-test it once again to confirm if the None option is available now.

If you are using the Optional / Required Toggle, your Server-Side Behaviour code should be something like this:-

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

@BaseScript FieldBehaviours behaviours

def radioButton = getFieldById(fieldChanged)
def radioButtonValue = radioButton.value as String

def textField = getFieldById('Sample Text Field')
textField.hidden = true

if (radioButtonValue == 'Option 1') {
textField.hidden = false

I hope this helps to solve your question. :)

Thank you and Kind regards,


Pramodh M Community Leader Aug 24, 2022

Hi @KSKumar55 

You need to add it in the condition

Try adding it in the condition

1 vote
Pramodh M Community Leader Aug 23, 2022

@Pramodh M , I tried the code in above mentioned url, but it didn't work after saving the behavior settings.

The custom field is not appearing in the create issue screen.

I executed the script in inline console of the initialiser.

Vikrant Yadav Community Leader Aug 23, 2022

@KSKumar55  Kindly apply script on Radio button Custom field then only it works. 

@Vikrant Yadav , @Pramodh M , I added the field as shown in the screenshot but still unable to make it work, can you please help.image.png




0 votes
Vikrant Yadav Community Leader Aug 24, 2022

Hi @KSKumar55  Kindly apply Behaviour on Test Field, like below screenshot :- 

Instead of making field mandatory from Behaviors, it would be better use Field Configuration for making field mandatory , so that None option won't visible on screen. 

def test = getFieldById(getFieldChanged())
def testvalue = test.getValue() as String
def flow = getFieldById("description") //replace with your custom field id

test.setRequired(true) //kindly make field mandatory from field configuration

if (testvalue == "Started") {
}else {

Radio Button.PNG

Suggest an answer

Log in or Sign up to answer