I have a situation where some issues in a project have a custom field, while others do not. If I perform a search like:
project = FOO and customField is EMPTY
This will only return the issues that have the custom field "customField" and where the field is empty, it will exclude all issues that aren't associated with the custom field "customField"
I'm trying to execute a query that will return all issues where either the custom field is empty, or where the custom field is not associated with the issue. Is there a way to do this?
I've found the solution, but it's really hack-ish.
customField IS EMPTY and
customField IS NOT EMPTY does not return tickets that have no
customField at all. So, basically,
NOT (customField IS EMPTY OR customField IS NOT EMPTY) should return them. As it turns out, it doesn't. Probably some pre-processing of query etc. But if you save it as a filter, it works. So..
customField IS EMPTY OR customField IS NOT EMPTY
NOT filter = "Has customField", you get issues that have no customField at all
project = FOO and (customField is EMPTY OR NOT filter = "Has customField")
Script Runer allows implement straigtforward solution with the only JQL query
project = FOO and issueFunction not in expression("project = FOO and (customField IS EMPTY OR customField IS NOT EMPTY)", "created <= today")
It's also slightly hackish, since expression always means "all issues from subquery", but at least it could be done via scripting w/o filter being saved
I've also tried a direct query via jira-cli and I also get an error:
jira-cli view --search-jql 'project = Development AND NOT (team IS EMPTY OR team IS NOT EMPTY)'
Please check <a href="https://status.atlassian.com">Atlassian Status</a> for any known issues.
If your page hasn't appeared again in 5-10 minutes, please contact our support team.
<a href="https://status.atlassian.com" class="aui-button aui-button-primary" style="width: 175px;">
<a href="https://getsupport.atlassian.com/servicedesk/customer/jst" class="aui-button">
To elaborate, I recently added a custom field, and had to retroactively populate the field with data for issues. So when I scan for project=ABC AND custom field = EMPTY for a particular issue type, it has nothing, and returns nothing, obviously. The system knows nothing of the newly added field. I have to "JQL it" using only "project=ABC AND issuetype = XYZ" and then add the new field column on the issue listing, and order it so I can see the empty field for older issues, and then bulk change with a script in a post function to perform the retro mapping. It would have been great had the system recognized the 'emptiness' of the new field, but that would require a system re-index, and who has time for that ?
@Jose Ramirez Hi again, sorry to hear about that. I am not familiar with problem unfortunately. Usually we make system re-index during maintenance times, outside of working hours when there's low traffic.
Btw you made sure that the field is searchable from the edit menu right?
I am also facing this issue while I do jql for Component field in a project.
Search1 : project= proj1 and "component" is not EMPTY
Search2 : project= proj1 and "component" is EMPTY
Search3 : project= proj1
Search3 is not equal to some of Search1 and Search2.
I second that. The "custom field" is EMPTY does not always work. I think this is a bug in JIRA (mine is 7.0).
I tried to reindex search, but it did not help.
This is somehow related to a situation where you have two or more projects with same set of custom controls. E.g. prj1 contains "custom field" and prj2 also contains "custom field".
The correct jql should be the following:
project=prj1 and cf is EMPTY
, where 10201 is the id of your custom field (you may quess it if you add a search column with your CF value and inspect corresponding html code).
We get results when searching 'is empty' but not all results for all tickets that don't have the field populated. I don't think this works as intended, but two of the above workarounds do the trick.
This was supposedly fixed years ago in https://jira.atlassian.com/browse/JRASERVER-6180 but I really don't think it was.
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