Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,296,438
Community Members
 
Community Events
165
Community Groups

How can I write a Jira expression for a field that could have multiple values?

I'm attempting to write a Jira expression to use in Build-your-own (scripted) Validator in my workflow. I want an error message to appear during the transition, on the transition screen, when a specific Fix Version is present. I've come up with the following expression, which works correctly to return false if the Fix Version is not 16.x.x.

!!issue.fixVersions && issue.fixVersions.some(it => it.name != "16.x.x")

Result: false

Unfortunately Fix Version can have multiple values and if I have 16.1.1 and 16.x.x and I run the same expression, the result is true.

What do I need to do differently in my Jira expression to return false if 16.x.x is present at all, regardless of the other Fix Versions? Is it even possible in JMWE or is there another validator option that comes standard with Jira?

2 answers

1 accepted

0 votes
Answer accepted

Hi @Karen Sterkowicz ,

If I understand you correctly, you want an error message to appear (the validator to fail) whenever any of the fix versions is exactly "16.x.x". In that case, I would use the filter() function, which can make the whole expression much smaller:

issue.fixVersions.filter(it => it.name == "16.x.x").length == 0

 This expression will return true, unless 16.x.x is one of the Fix Versions. It does not matter whether you have no Fix Versions, one or multiple Fix Versions applied. 

Cheers,
 Oliver

@Oliver Siebenmarck _Polymetis Apps_ This is exactly what I needed. Thank you very much for the assist.

Karen

Hi @Karen Sterkowicz ,

you could try with this JQL:

fixVersion is not EMPTY AND fixVersion in ("16.0.0","16.0.1", ...)

with all Fix Versions you want in parentheses.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,550 views 37 45
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