JQL Query to remove stories with specific labels

Chetan Krishna
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 13, 2025

I have multiple issues with specific labels for example say "X_Required", "Y_Required", "Z_Required" so on and most of them are without labels.

Now I want to write a JQL such that it removes all the issues with label "X_Required" and "Z_Required". The result should show only those issues which has no labels and "Y_Required". To do that I write something as this 

labels not in (X_Required, Z_Required)


but this also removes issues without labels.

2 answers

2 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2025

Hi @Chetan Krishna -- Welcome to the Atlassian Community!

First thing, you describe "removes all the stories...".  If you mean deleting the stories, I recommend not doing that as there is no automatic backup or "undo" operation to correct issue deletion.  Instead, I recommend disabling the delete issue permission for all users except for Jira Site Admins and then use the issue Resolution field to indicate abandoned / removed issues.

Back to your question...

If you are just trying to remove the issues from the results shown, you may also ignore issues where the labels field is EMPTY, please add that to your JQL:

project = myProject AND ( labels IS EMPTY OR labels NOT IN (X_Required, Z_Required) )

Please note the use of parentheses wrap around the use of the OR keyword.

To learn more, please see this documentation: https://support.atlassian.com/jira-software-cloud/docs/jql-keywords/#EMPTY

Kind regards,
Bill

Chetan Krishna
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 13, 2025

Thank You

Like Bill Sheboy likes this
1 vote
Answer accepted
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2025

HI @Chetan Krishna 

JQL: (labels not in (X_Required, Z_Required) OR labels is empty)

Chetan Krishna
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 13, 2025

Thank You 

Suggest an answer

Log in or Sign up to answer