It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Eitan Gur Mar 13, 2016

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

1 vote
Answer accepted
Kristian Walker Community Leader Apr 04, 2016

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


Eitan Gur Apr 07, 2016

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





Kristian Walker Community Leader Apr 07, 2016

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

770 views 7 0
Join discussion

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