Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Making a custom field mandatory based on the value of a fix version

My fix version values are 2019-ABC, 2019-DEF and 2019-XYZ.

I want a custom field called "Release Date" to be mandatory when some selects fix verson as "2019-XYZ". 

Can someone help me with this using Script Runner?

2 answers

1 accepted

1 vote
Answer accepted
Ravi Sagar Community Leader Oct 15, 2019

Hi @Sunil Mandalika 

Here is the code for you.

def fixVersion = getFieldById(getFieldChanged()).getValue()
def releaseDate = getFieldByName("Release Date")
log.debug("Fix Version: " + fixVersion)

if (fixVersion.toString().contains("2019-XYZ") ) {


} else {


Use this code in the behaviour. Create a behaviour, define mapping to a project, add the Fix Version/s field and use the above code in the server-side script.

I hope it helps.


Thanks, this worked for me.

Like Ravi Sagar likes this
Ravi Sagar Community Leader Nov 12, 2019

That's great. Thanks for letting me know.

@Ravi Sagar Sorry for the delay in responding to your answer. The script worked for us. Thank you for that. To take this a step further, can we write a regular expression in stead of checking for a constant called "2019-XYZ".

My fix version are named as "YEAR-MMM-OFFSCHEDULE", the year and month change for every month, but the last phrase does not change and it always alphabets. 

I would like to change "

if (fixVersion.toString().contains
("this to be a regular expression which validates XXXX-XXX-OFFSCHEDULE"")

the first 4 XXXX are numbers

the second 3 XXX are alphabets

Thanks @Ravi Sagar : It Helped me achieve similar requirement for Affect's Version.

Like Ravi Sagar likes this
Ravi Sagar Community Leader Feb 18, 2021


Hi @Sunil Mandalika ,

With the help of Behaviours From ScriptRunner for Jira you will be able to configure this.



Suggest an answer

Log in or Sign up to answer

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