Forums

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

How do I use JIRA automation to check if there exists an issue with a specific summary text in an Ep

Peter Ruan
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!
October 28, 2023

How do I use JIRA automation to check if there exists an issue with a specific summary text in an Epic? And if it does not exist, then create it.

I don't know if that's possible, that's why I'm asking. I've tried using For Stories branch but if the Epic doesn't have any sub issues, then the For Stories loop won't even get triggered.

2 answers

1 vote
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.
October 29, 2023

Hi @Peter Ruan -- Welcome to the Atlassian Community!

One way to do that in an automation rule is:

  • write a JQL statement to find the issue (e.g., where the parent equals the epic's key and the summary contains what you want to check)
  • use that JQL with a lookup issues action
  • check if the result count is 0 (i.e., {{lookupIssues.size|0}} equals 0, using and advanced compare condition)
  • and if the count was 0, create the issue

Kind regards,
Bill

Peter Ruan
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!
November 2, 2023

Hi @Bill Sheboy thanks for the tips.  Can you please elaborate a bit more? 

I've the following use case:

  1. a JQL finds all affected issues
  2. loop through all the results from step#1, which are all Epics, to check if there are issues that have:
    • 0 matching issues within the Epic to the 3 pre-defined issue summaries (A, B, and C ) and creating them.
    • if there are matching User Stories in the issue, figure out which of the 3 are missing and create them accordingly.

I am able to do #1, but am stuck on #2.  TIA!

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.
November 2, 2023

That seems a variation on your question, as you now want to check for multiple, pre-defined summaries. 

For that case, I recommend doing these one by one to confirm presence of each issue before proceeding.  Trying to do this in a loop may be possible, but seems like the behavior will be less predictable.

Perhaps like this, using if/else conditions...

  • use Lookup Issues with JQL to detect your case A
  • with an if/else condition
    • check if the count is 0 for the lookup
    • create the issue(s) needed
  • use Lookup Issues with JQL to detect your case B
  • with an if/else condition
    • check if the count is 0 for the lookup
    • create the issue(s) needed
  • use Lookup Issues with JQL to detect your case C
  • with an if/else condition
    • check if the count is 0 for the lookup
    • create the issue(s) needed
  • ...
0 votes
Bernd Anderer
Contributor
October 29, 2023

I had the same problem a while ago, and chose to solve it through the workflow. As I can not run an automation on an Issue that does not exist, I did the check on Create and then - if the summary already exists - moved it to a „Duplicate exists“ status. There the assignee was able to resolve the problem.

Not really what you want, but afaik checking values before the issue is created can not be done with automations (yet)

Suggest an answer

Log in or Sign up to answer