JQL search to specify a single option in a Multiselect?

Steven Behnke Community Champion Sep 30, 2014

Is it possible to write a query that pulls up only issues that have exactly the specified option in their multi-select field?

I have a field, let's call it Color. It's populated with Red, Green, and Blue. Some of the issues have Red and Green, some have Red and Green and Blue, some just have Red. I want a query that pulls up ONLY issues with Red selected in the Color field, no Red and Green and no Red and Blue.

Now, I know I can do something like: "Color" not in (Green, Blue) to pull only Red issues. However this doesn't solve my problem, because my Color field has about sixty potential options. The query would become unwieldy.  "Color" not in (Green, Blue, Yellow, Purple, #234343, Orangred, etc) Furthermore options are added regularly so this would require these JQL Queries to be modified each and every time. 

Is there a better solution?

1 answer

This widget could not be displayed.

Hi,

You can create a scripted field that returns the number of selected options as suggested in this comment and then use that field in your query. So if you call the field numberOfOptions than it would look like this:

Color = "Red" AND numberOfOptions = 1

Regards,

Geert

Steven Behnke Community Champion Oct 02, 2014

I have upvoted this answer as it fulfills the requirements but I await further help as an additional custom fields are frowned upon for the JIRA instance I am working in.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

128 views 2 0
Join discussion

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