Behavior Plugin - Setting a custom date picker field to be required if certain value was chosen in radio buttons custom field

Hi All,

I'm trying to set a date picker custom field to be required if certain value in another custom field (radio buttons) was chosen.

Tried with no success:

def InstallDate = getFieldByName("Installation Date")
def InstallStatus = getFieldById(getFieldChanged())
def selectedOption = InstallStatus.getValue() as String
def isInstallSelected = selectedOption == "Certain Value"
InstallDate.setHidden(! isInstallSelected)


def installStatusRadioButtons = getFieldByName("Installation Status")
def installDatePicker = getFieldByName(getFieldChanged())
def installStatusRadioButtonsValue = installStatusRadioButtons.getValue()
if(installStatusRadioButtonsValue == "Certain Value"){

Also I'll be glad for some clarification what should I use:

Initialiser Function


Add Field

Add one or more fields to this Behaviour.

Maybe configure some general settings in a certain way?


Thank you in advance!

1 answer

1 accepted

Hi Eitan,

In order to answer your questions above you should use the Add Field option in order to configure the behaviour on a particular custom field. You can find more information on how to configure Behaviours here.

Also I have attached below a sample script along with its config that will allow you to make a custom date picker field required based on the value of a radio button.

This code was developed and tested on JIRA 6.4.12 using ScriptRunner



// Get pointers to my fields
def radiocf = getFieldByName("Installation Status")
def datecf = getFieldByName("Installation Date") 

// Get the radio buttons value
String radioCfVal = radiocf.getValue()

// If option A is selected in the Installation Status radio buttons 
// then make Installation Daterequired else make it optional.
if(radioCfVal == "A"){


image2016-4-4 15:56:55.png

I hope this helps


Kristian, thank you for the great answer! Works like a charm.


Just an additional question if you're able to advise-

The date field becomes required only when going to "Edit" option in the issue and prevents from leaving the screen as expected.

However, the condition field ("Installation Status") is editable also in the default screen. There, if I'm picking the "A" option - nothing happens. Apparently because the date field doesn't appear on the default screen until being edited and populated with any value.


Do you have any proposals how can I condition this behavior to happen on the default screen also?


Thank you





HI Eitan,

Behaviours only happen on the create and edit screen.  The fields would need to be available on both screens in order for the behaviour to work.

I hope this helps.


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

77 views 0 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you