I have a custom field called gitBranch in my Jira project and I’m trying to set up filters for issues across various branches, such as development, main, and staging.
For simple cases, the filters work well, like:
gitBranch = "main"
gitBranch IN("main")
But, when it comes to more complicated scenarios, especially those involving exclusions, I’m having trouble. For example, I want to filter development tickets with:
gitBranch = "dev" AND NOT (gitBranch = "stage")
Unfortunately, any filter that includes the NOT operator fails on my end. Additionally, I can’t seem to use basic operators like not in or !=. I have a test ticket that exists in both ws-640 and dev branches, but none of the negative conditions seem to apply.
Has anyone resolved similar issues regarding custom field filters in Jira using NOT operators? What is the correct way to set up filters for excluding certain branch conditions?
sounds like a permissions or field config issue. check if your gitBranch field is searchable in JIRA’s admin settings - custom fields sometimes get created but search permissions stay off. try escaping the field name like cf[10001] != "stage" using the actual field ID instead of the name. this worked for me when regular names failed.
I’ve encountered a similar problem with custom fields managing various branch statuses. It seems likely that your gitBranch field might be treated as multi-value or could be experiencing an indexing issue. Start with a simpler approach by trying gitBranch ~ "dev" using the contains operator to see if it works. If it does, your field may be storing values as comma-separated or arrays. Then, for exclusions, apply gitBranch !~ "stage". Additionally, ensure your custom field indexing is up to date; reindexing can often resolve odd behaviors related to the NOT operator. It’s also important to verify that the field context is correctly set for all issue types, as this can lead to inconsistent JQL performance.
This is probably a null value issue with your custom field. Jira’s NOT operator includes empty/null fields, which messes up your results. Try using parentheses to be explicit: gitBranch = "dev" AND gitBranch != "stage" instead of NOT. Also make sure your custom field can handle multiple values if tickets can be in multiple branches at once. I’ve found != works fine with custom text fields. If it’s still broken, check whether your gitBranch field is set up as multi-select instead of single text - multi-select fields need different JQL syntax.