Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Writing validator in JMWE to validate label containing at least one entry starting with a string

Hi,

I've tried to search for a post but can't find one that matches. I would like to have a JMWE validator that makes sure that on the issue that I'm trying to transition, there is at least one (there may be several) labels that start with a certain string. No labels at all are not accepted.

Let's pretend that I have the requirement to have at least one label starting with "US-" - so "US-FL", or "US-TE" e.g.

So no label would give an error, one label saying "CA-OT" would not be OK but having two labels saying "CA-OT" and another "US-WY" would be OK as would having "US-AL" and "US-NY".

1 answer

1 accepted

1 vote
Answer accepted

Hi @Ola Nissen ,

this is the Jira Expression you need for your Build-your-own Validator:

!!issue.labels && issue.labels.some(label => label.indexOf("US-") == 0)

 Regards,

David

Thanks for the quick answer. Tested and verified. Excellent help.

Suggest an answer

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

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

806 views 24 28
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