USE CASE NEED:
PROBLEM:
The initial JQL query, without solving the problem, is:
issuetype = Defect and "External ID" is EMPTY
I can't figure out how to have that as an OR where it checks if it's empty or if it just has whitespace characters
You could get these results using ScriptRunner for JIRA's issueFieldExactMatch script JQL Function.
issuetype = Defect and ("External ID" is EMPTY OR issueFunction in issueFieldMatch("", "External ID", "^\\s*$"))
The above would find any issues where the contents of the field was only whitespace, or the field was empty. You could use more elaborate regular expressions to search for single-character entries and the like.
In fact, if you had a pretty good idea what the format of your External ID field should be, then you could write a query to find every issue where the External ID field did not match the expected format.
issuetype = Defect AND NOT (issueFunction in issueFieldMatch("", "External ID", "^external ID regex goes here$"))
You were so close to being spot on (but it complained when I didn't supply a sub-query)! Thanks! I forgot about the issueFieldMatch!
This is the solution:
issueFunction in issueFieldExactMatch("issuetype = Defect","External ID"," ")
For reference, what I had to change was the correct arguments for that field:
issueFieldExactMatch (Subquery, Field name, Field value)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
or ... well ... okay it's close enough and on the right track? I just created a Defect issue with a whitespace External ID, yet the query didn't find it .. hmmm.... At least the query is compiling though
Oh and i couldn't do "^\s" as it said that wasn't an allowed character (i've got scriptrunner 4.3.4)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Quite right! Should have doubled the backslash. "^\\s*$" should mean "start of line, any amount of whitespace characters (including zero), then end of line".
https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_issuefieldmatch
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jonny Carter [Adaptavist] so while your modified query (had to add a sub-query to yours) does actually compile, it still doesn't actually match the one test Defect issue I have with the External ID single line text field with " " single whitespace as only entry. Can you try it out on your own system with a similar single line text field for any version type?
issueFunction in issueFieldExactMatch("issuetype = Defect","External ID","^\\s*$")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was able to get it to work on a test JIRA instance with a simple Text Field. My original regular expression included fields where that field was empty, but the following got just the issue where the field was nothing but whitespace characters:
issueFunction in issueFieldMatch("", "Emptyable field", "^\\s+$")
You might try removing the subquery and any other qualifiers you have on the query you're running. Perhaps one of them is filtering out the stuff you want?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issuetype = Defect and (
"External ID"
is EMPTY or "External ID"
= " ")
or maybe
issuetype = Defect and
"External ID"
in (EMPTY, " ") <- or any other characters you can think of.. because next they will add a "." to get around any mandatory field checking!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seemed like it could be on the right path, but the "=" nor "in" operators can be used with the standard single line text field.
Sorry for not providing the context of what field type "External ID" was; I thought I had. Thanks though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Update:
As "External ID" is a single line text field, it only supports the is, is not, ~, and !~ operators.
Also, "External ID" ~ " " returns the JQL error:
The field 'External ID' does not support searching for an empty string.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may want to convert it into a SQL query, filter by the EXTERNAL_ID column and then convert it back into a JQL again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Export all to excel? And do a find and replace ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Re-import back in via CSV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.