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?
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") ) {releaseDate.setRequired(true)} else {releaseDate.setRequired(false)}
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.
Ravi
Hi @Sunil Mandalika ,
With the help of Behaviours From ScriptRunner for Jira you will be able to configure this.
Thanks,
Avinash
Thanks, this worked for me.
That's great. Thanks for letting me know.
@Ravi Sagar _Sparxsys_ 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
It looks like you're new here. Sign in or register to get started.