How to add multiple validation rules to a single custom field?

I am attempting to add multiple validation rules to single custom field to ensure the values are valid. I am using a text box custom field called 'environment' which can have either dev,test or prod.

I am aware that I can use a drop down box but I want this action to be a bit more deliberate i.e: forcing the user to enter the environment value.

Now I can add a validator rule to the transition like this which works:

cfValues['environment'] == 'dev'

However Its valid for 'test' and 'prod' so I tried the following which doesn't seem to work:

cfValues['environment'] == 'dev' or  cfValues['environment'] == 'test' or  cfValues['environment'] == 'prod'

Also tried adding separate validator rules for the same transition:

cfValues['environment'] == 'dev' 
cfValues['environment'] == 'test'
cfValues['environment'] == 'prod'

Any ideas on how I can ge this to work via validators? or failing with best method forward?

1 answer

0 vote

That's not how validators work natively, so you must be using a scripting plugin of some sort.

Could you tell us which one?

(Although, you probably need to join your conditions with OR statements, but I can't tell you how without knowing what you're using for the script or rule engine)

I suspect its script runner as our jira instance was setup by an external party. When I select a validator for the transition, it gives me the option to prform a it via a script. The above is a the simple version where it already pre filled it in for me(not an external script) and then I just modified the actual values.

Mmm, it's worth knowing exactly what the plugin is - "cfValues" isn't a script runner function, so I don't know what's going on.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 2 hours ago in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

55 views 4 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