How to: make select list required if number field > 0 (via Behaviours)?


We use JIRA v.6.4.5 and ADAPTIVIST v.
I try to make custom validator via Behavior feature...

Some details:
image2016-5-13 17:15:46.png
image2016-5-13 17:15:18.png

My Code:

import com.atlassian.jira.issue.Issue
def n = getFieldById("customfield_15832") // NUMBER
def tm = getFieldById("customfield_10355") // Select List
def n2 = n.getValue() as Long
if (n2 > 0){

But it does not work.

Please assist.

1 answer

1 accepted

1 vote

This needs to be attached to the field that is driving whether the other one is required or not, in this case customfield_15832. You seem to have it attached as an initialiser, which only fires once. 

Hi @Jamie Echlin [Adaptavist], i am so sorry but your answer is unclear for me.
Can i expect more details of what do you mean?

In your screenshot you have set that as an initialiser. Remove the initialiser, add the field customfield_15832, whatever it's name is, and attach the script as a server-side script, in that behaviour.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published 4 hours ago in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

233 views 3 4
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