Forums

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

How to set rule automation to not create a linked issue if one is pre-existing

Stephen Johnston September 3, 2025

I have a rule automation set up in my project that creates a test ticket in the Zephyr project

I am trying to set it up so if I transition the same statuses again the rule will not create another linked issue if it already exists

New test ticket has the following naming convention for the summary field . The goal of step 4 below is to not create the Zephyr test if there is already a linked ticket 

{{Issue.key}} - {{Issue.Summary}}

 

 Workflow

Auto Steps.png

Step #4

Auto Steps Part to stop recreating.png

 

 

1 answer

2 votes
Mikael Sandberg
Community Champion
September 3, 2025

Your JQL is missing "" around the text you want the search for, and I would do a specific search like this:

summary ~ "\"{{issue.key}} - {{issue.summary}}\""

By using "\" \"" the search will only be for that phrase, not any of the words.

Stephen Johnston September 3, 2025

I made that update but it still creates another linked issue

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.
September 3, 2025

Hi @Stephen Johnston 

Yes, and...to the suggestions from @Mikael Sandberg 

I sometimes find that related work items condition with links and JQL produces inconsistent results when checking for the absence of work items.  My hypothesis is we do not how the rule implements those two checks together for linking and the JQL, thus it may not be what was intended.

 

As an alternative building on Mikael's suggested change to the JQL with the exact match syntax, I recommend using the Lookup Work Items action to take better control of the rule steps.  For example, with changes to your rule steps:

  • trigger: work item transitioned...
  • condition: project is one of...
  • condition: issue type equals Story
  • action: lookup work items, with JQL of
issue IN linkedIssues("{{issue.key}}")
AND summary ~ "\"{{issue.key}} - {{issue.summary}}\""
AND issueType = Test
  • smart values condition:
    • first value: {{lookupIssues.size|0}}
    • condition: equals
    • second value: 0
  • action: create a new Test...

 

Kind regards,
Bill

Stephen Johnston September 3, 2025

Thanks Bill

It run successfully but it didn't create a Ticket in the Zephyr project

Work item transitioned
09/03/2025, 17:03:55

xxx-63858: Test zephyr new approach
Quality Assurance
Work item fields condition
09/03/2025, 17:03:55

The following work items passed:
xxx-63858
Work item fields condition
09/03/2025, 17:03:55

The following work items passed:
xxx-63858
Lookup work items
09/03/2025, 17:03:55

A search during custom value definition found no work items.
{{smart values}} condition
09/03/2025, 17:03:55

The following work items did not match the condition:
xxx-63858

 

New Workflow.png

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.
September 4, 2025

Thanks for that information, @Stephen Johnston 

Let's try a couple of things...

In your rule, before the lookup action, use the Log action to write that dynamic JQL expression directly to the log.  That will help confirm what it contains when the rule runs.

With that JQL in hand, and using your example work item from the trigger, try to run that JQL standalone (outside the rule) to check if it is accurate.

Stephen Johnston September 4, 2025

@Bill Sheboy  Log shows "\"XXX-63858 - Test zephyr new approach\""

I am wondering is my issue due to the new test ticket being created is in a different project?

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.
September 4, 2025

Yes, that is likely the problem if your rule scope (in the details at the top) is single-project:

Single-project scope rules can create (or clone) work items into other projects, but they cannot see them in any other way.

The rule will need to change to multiple-project or global scope, depending upon what is needed for your scenario.  Please discuss this with your Jira Site / Product Admin as they will need to make the change from the global automation area.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events