Forums

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

How to create an automation rule which takes links issue with same field value as the parent issue

E R March 18, 2024

Our team is trying to create a JIRA built-in test case management tool. So we created two issue types called Test Run and Test cases.

We have also created a new field called Test category where you can select multi-values from a dropdown list.

We wanted to create an automation rule where if the Test category field is updated by a user for the Test Run, it should link all Test cases having the same value.

Sample:

User updates the Test category field of QA-1 with issue type "Test Run" with the values Twist.

Automation rule should link issues TC-1, TC-2, TC-3 with issue type "Test cases" to QA-1 as TC-1, TC-2, TC-3 all have values "Twist" in their Test category field.

 

Here's a sample flow but with hard-coded values:

`{{#jql}}issuetype = “Test case” and “Test category” = Twist{{/jql}}`

Screenshot 2024-03-19 at 2.28.03 PM.png

 

1 answer

1 accepted

1 vote
Answer accepted
Ste Wright
Community Champion
March 19, 2024

Hi @E R 

Something like this should work:

  • Trigger: Field value changed
    • Field = Test Category
  • Branch: Related Issues
    • Type = JQL
    • JQL - issuetype = "Test Case" and "Test Category" = "{{triggerissue.Test Category}}"
      • Branch-Action: Link Issues
        • Type = Link Type Here
        • Issue = Trigger Issue

---

This is a dynamic version of your rule - the {{triggerissue.Test Category}} smart value populates the JQL query with the value found in the trigger issue, rather than needing it hardcoded into multiple IF/ELSE rules.

Once the Branch finds all relevant Test Cases, you can then execute the action against each of the TC issues to link them back to the Test Run.

---

Let us know if this helps :)

Ste

E R March 19, 2024

Thanks Ste, you're a legend. It works fine!

 

On a another note, some of the "Test Category" values have a "/" character in them which I didn't realise is a reserved JQL character. Hence, we get an error like this:

QA-1: "((issuetype = "Test Case" and "Test Category" = Twist/Shout) AND (key != QA-1)) AND (project in (10001))" - Error in the JQL Query: The character '/' is a reserved JQL character. You must enclose it in a string or use the escape '\u002f' instead.

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.
March 20, 2024

Hi @E R 

The error message is suggesting how to fix that: put quotation marks around the value.

In your rule, that would be this:

issuetype = "Test Case" AND "Test Category" = "{{triggerIssue.Test Category}}"

 

Kind regards,
Bill

Like # people like this
Ste Wright
Community Champion
March 20, 2024

Hi @E R 

Bill's right - you can add the quotation marks where it's more than one word without special characters, which will box in the query.

Give it a try, and let us know if it rectifies the issue :)

Ste

Like E R likes this
E R April 25, 2024

works like a charm

 

Like # people like this

Suggest an answer

Log in or Sign up to answer