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

Hi @Sunil Mandalika ,

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

Thanks,

Avinash

0 votes

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

Suggest an answer

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

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

842 views 5 22
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