JIRA JQL - search for issues where custom field does not exist
Asked Answered
H

3

7

I added a new custom field "Deferred to Date". Because custom fields are optional, none of the existing issues have it.

Now I want a JQL search query for all issues where the deferred date is null (doable) or the deferred date field doesn't exist for the record (this is what I can't find).

I looked at the JQL instructions at http://confluence.atlassian.com/display/JIRA/Advanced+Searching but I don't see anything for checking whether or not a field exists.

Hope this is clear.

Heptarchy answered 21/3, 2012 at 15:0 Comment(2)
Try searching for "MyFieldName is empty"Revolution
I tried that. No luck. Do you know it to work? I don't think it does what you think it does.Heptarchy
J
10

The JQL query that you need is

"Deferred to Date" is empty

Or (equivalent),

"Deferred to Date" is null

However, if you have just added the new custom field, then you need to re-index your JIRA instance before either of these JQL queries will work.

The "Re-Index" button can be found in the JIRA Admin under "Indexing",

  • JIRA Admin
  • General Configuration
  • Indexing
  • Re-Index
Judejudea answered 8/4, 2013 at 23:11 Comment(1)
Re-indexing was the key for me. Couple hours lost on thisFeuchtwanger
K
2

Like Andrew mentioned, in order to get "is EMPTY" to work after a custom field is added, you will have to re-index Jira.

This may not always be feasible in production environment, especially if new custom fields are being created frequently (which is most likely the case if you use a plugin like CM4J, allowing project admins to configure multi-context custom fields).

Fortunately, if you have Scriptrunner for Jira installed, you can use the following JQL query to get all instances of a specific empty field without re-indexing:

issueFunction in issueFieldMatch("<sub-query>", "<field name>", "^$")
Kaplan answered 24/1, 2019 at 17:32 Comment(0)
M
1

You need to reindex your jira instance, may be that the problem

Marroquin answered 26/9, 2012 at 12:11 Comment(1)
Please expand on your answer (ie. what will a re-index do)Neglect

© 2022 - 2024 — McMap. All rights reserved.