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

Find issues with specific SLA field beeing empty

Corentin Mehat Jan 10, 2017

Hello,

Is there a way to create a JQL matching issues where a certain SLA field is empty ?

The only operators I found where numeric ones (=, <, >, ...) but I couldn't find any "is empty" operator for example.

It's JSD 1.2.6.1 / JIRA 6.3.15 , but I wonder if this is possible with latest versions.

 

Thanks in advance for your help,

3 answers

1 accepted

2 votes
Answer accepted
Morgan Knicely Atlassian Team Apr 13, 2018

My co-worker asked this question and I thought it was simple. I was so wrong! I couldn't let it go and spent some time investigating this question of "find not breached".

Base set

project = MYPROJECT

100 issues

SLA is breached

project = MYPROJECT AND "My SLA" = breached()

5 issues

SLA is not breached

project = MYPROJECT AND "My SLA" != breached()

50 issues

Hrm, I would think that issues where the SLA has not been run would be included in the results. That's now how Jira typically works though. Usually in JQL, "!=" does not include issues where what you're searching for is EMPTY e.g. null. This search only returns issues that have the SLA field populated and the SLA is breached. It leaves out the ones that have no value for this SLA at all.

Attempts to find SLA is empty / unset / null

You might think we could invert the "= breached()" part to find the empties, but nope, that yields that same answer as above.

project = MYPROJECT AND NOT ("My SLA" = breached())

50 issues

So just to drive this home, using these SLA functions will only show us issues that have run that SLA, breach or not. Here is how to get all issues that have run this SLA.

project = MYPROJECT AND ("My SLA" = breached() OR "My SLA" != breached())

55 issues

We can't invert this either... JQL parses the query, flattens it out, and comes up with 0 issues just like it did before. For JQL, there aren't any issues that have run this SLA which are not either breached or not breached. My head hurts!

project = MYPROJECT AND NOT ("My SLA" = breached() OR "My SLA" != breached())

0 issues

The Solution

We'll take advantage of another JQL quirk to solve this. When Jira evaluates saved filters it doesn't fetch it and flatten out the query like it does above. It just gets all issues from the saved filter and compares it to the rest of the query result. So if we save "Time to response" = breached() in a filter, we can use it to get everything else that doesn't match.

Save a filter named "My SLA Not Empty" with this JQL:
project = MYPROJECT AND "My SLA" = breached() OR "My SLA" != breached()

55 issues

Now we can reference this filter and invert it to exclude issues that DO have the SLA.

project = MYPROJECT AND filter != "My SLA Not Empty"

45 issues

We have a winner!

There's a Feature Suggestion for this to make it easier. Vote it up! https://jira.atlassian.com/browse/JSDSERVER-4650

One thing to watch out for is that in really large instances referencing filters in this way (sub queries) can create excessive memory pressure. Jira retrieves all issues that match the referenced filter, retrieves the issues from the rest of the JQL, and processes them in memory to return the desired result set. Check how many issues are returned by your saved "SLA Not Empty" filter. If it is many thousands, consider narrowing it down with created > DATE or other criteria to reduce the number of issues to compare.

Corentin Mehat Apr 13, 2018

Accepting your solution since it seems to work, but I'd rather have the JSDSERVER-4650 for a clean way to solve this :-)

0 votes
Vladimir Yakimov Jan 11, 2017

Hi, 

Just tried in 3.2.7 and 3.3.0 and it's not possible in later releases either. Same operator options available.

Regards,

Vladimir

0 votes
Ismael Olusula Jimoh Jan 13, 2017

This operation was intentionally not added as from our knowledge of it, the SLA should be based on what was configured by the project Admin, hence all issues that fit the JQL which uses the SLA would be affected.

Instead of looking for the SLA in such a case, search for the JQL for the SLA as all issues that fit it should be empty as well.

If there is a special use case where the SLA value is somehow cleared, we would recommend fixing the SLA itself.

There is a suggestion raised here: https://jira.atlassian.com/browse/JSD-4650 for this feature and probably more light would be shared on this by the developers on the ticket for anyone interested.

Corentin Mehat Jan 13, 2017

Hello,

Thanks for sharing the link, I was going to do it just now after creating the suggestion smile

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Software

Demo Den Ep. 5: Meet Jira Mobile

See how to use Jira on the go! Demo Den Episode 5 is here: meet Jira Mobile with  Jira  Product Manager Rayen Magpantay.  Demo Den is in our monthly series where a Jira PM demonstrates...

315 views 1 10
Join discussion

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