Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if issue not yet exist in automation

Devon Chan October 10, 2023

I know there is JQL like this to find if it is exist:
Summary ~ "keyword"

How about to check if it is not exists?

I am trying to write sth like:
if(issue not exist){ create issue }

However I can now only write sth like this (I have to add rubbish action otherwise it gots error):
if(issue exist){ rubbish action } else {create issue}

1 answer

1 accepted

1 vote
Answer accepted
Jack Brickey
Community Champion
October 10, 2023

You can check the Summary for the absence of text. For example...

summary !~ "hello"

The above would return all issues that do not have the word hello in the summary field. Note, checking for the absence of text can be a bit fragile.

Following the JQL statement you can check for the number of items returned and if zero, you can proceed with your action.

Devon Chan October 10, 2023

I have tried sth like this:
(summary ~ "hello") = 0

However JIRA won't let me pass, is there anything I've missed?

Jack Brickey
Community Champion
October 10, 2023

no, that will not work. you need to create an automation rule. I mistakenly assumed that was the environment you were working in.

So that I might be able to further assist let's step back a bit. Could you explain your exact use case? What is it that you are trying to accomplish and why? It seems that you wish to create an issue of a certain summary if an issue with that summary does not exist. However I may be off a bit here and I think a better understanding of the exact requirements would help.

Devon Chan October 11, 2023

> It seems that you wish to create an issue of a certain summary if an issue with that summary does not exist.

Yes, exactly, you already got it.

I am working on creating an automation rule, and writing an JQL query in the if-block, writing sth like (summary ~ "hello") = 0 and hoping it would work but getting a red error unfortunately.

Jack Brickey
Community Champion
October 11, 2023

Hi @Devon Chan ,

I've taken the time to create an automation for you which is illustrated below. To be honest I'm a bit perplexed by your use case and how you plan to run this query. I can't imagine that you're checking for the same text repeatedly. Maybe you're wanting some dynamic automation where it would prompt you for the text to search for and then if nothing found create a new issue? 2023-10-11_12-50-20.jpg

Like # people like this
Devon Chan October 13, 2023

Thank you Jack!!

My instinct feel that there should be sth like "insert into if not exists" as in SQL, however JQL do not have a simple way to do that, which makes me feel weird.

Anyway, I can tell you my use case. I have to manage more than 60 products at the same time therefore I have to make this efficient enough to make product cards with tags, every month. That's why I need the automation to do that for me instead of manually making every card by hand.

Wish you a nice day :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events