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

Behaviours: How to make custom field required when I select a specific radio button option?

Version - Behaviours with Jira v8.5.1 

I have been using a Beavhiours script for several months now with great success. It currently shows/hides various fields based on user selections (lists, cascading lists, checkboxes). I want to condition the required/optional condition of a text field based on the value of a radio button.

IS: Text field required status not changing when I make correct radio button selection
SHOULD BE: Text field should become required when I select specific radio button

Goal: Use Adaptavist Behaviours to make textField required when both 1. a radio button (radioField) and 2. a cascading list (listField) meet a certain selection condition.

Here is my sample code in one of the Behaviours "Fields":

// set pointers to custom fields (list, radio button, and text)
def listField = getFieldByName ("My List")
def radioField = getFieldByName ("My Radio")
def textField = getFieldByName ("My Text")

// get cascading list value (parent and child)
String listString = listField.getValue()
// if cascading list matches one of two selections, show the radio button field
if ((listString == "[Parent1, Child1]") || (listString == "[Parent1, Child2]")) {
} // otherwise, hide the radio button field
else {
// get the value of the radio button field
String radioString = radioField.getValue()
// if both the cascading list and radio button value match specific values, make the text field required
if ((listString == "[Parent1, Child1]") && (radioString == "Radio Option")) {
// in all other cases, make the text field optional
else {


This code works except for making the text field required. I can get the text field to become required with the following steps:
1. Set listString to "[Parent1, Child2]"
2. Set radioString to "Radio Option"
3. Set list string to "[Parent1, Child1]"
In this case, we choose one list option that shows the radio button field but does not meet the conditions for making the text field required ("[Parent1, Child2]"). Then we can set the radio button to the correct option. Then set the list option to the one that meets the 2nd condition of making the text field required ("[Parent1, Child1]").

Given this behavior, it seems like the radio button field value is only being updated when I change the list field selection. But shouldn't it be independent of my list selection?

Additional information:
None of my radio buttons will update their value when I change the selection. I determined this by using log.warn on the radio button value and then checking the print statements in the last several lines of "atlassian-jira.log of the built-in script "View server log files". The radio button stays at its default.

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

103 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you