I am trying create a filter that list all issues that do not have specific text (e.g Code 1234) in the comments section. I have tried comments !~ "Code 1234" with no success but I do get results with comments ~ "Code 1234" (though not the results I am expecting)
We have ScriptRunner installed if that helps. Could this be a limitation of ScriptRunner?
Hello Dave,
1. If you're doing this regularly, consider: Having users flag issues that include Code 1234 in a label or custom checkbox (e.g., "Code 1234 added").
Then you can use -
project = XXX AND labels != "code-1234"
2. If you have ScriptRunner for Jira, you can try and use its JQL functions
Eg - issueFunction not in issueFieldMatch("project = XXX", "comment", "Code 1234")
his returns issues in project XXX where comments do not contain Code 1234.
@pawarsachin84 thanks for the feedback.
While it still would be nice to know why my code wasn't working, but the Label idea seems to be an elegant work-around. I will also try out your recommended JQL function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just tried the AND labels != "code-1234" and it did not work but AND labels = "code-1234" does work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dave Stillwell - This is expected because:
labels != "code-1234"
does not mean “issues that don’t have this label.”
Instead, it means:
“Issues that have a label, but that label is something other than code-1234
.”
So if an issue doesn't have any label at all, it is excluded from the result.
To truly get issues that do not have the code-1234
label (including those with no label at all), use this JQL:
project = XXX AND (labels is EMPTY OR labels not in ("code-1234"))
labels is EMPTY
: matches issues with no label at all
labels not in ("code-1234")
: matches issues with labels, but not this one
Combining both with OR
ensures you include:
Issues that don’t have any labels
Issues that have different labels
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank very much for the clarification. That makes total sense.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It looks like you are using JSM/Jira for the cloud. I wonder if it is because I am using Data Center.
I'll create some dummy tickets in my test environment to do some more testing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.