Close Epic when Selected Linked Issue Types are Closed

Adam Ziecik March 13, 2023

Hello All,

 

I am looking for a way of using Jira Automation for closing Epics that have specific issue types closed (in moved to specific status or resolved). The issue I am facing that what I have come up with will not work as we also use XRAY issue types such as tests and these will never be closed or removed in these Epics. Thus, I would like to exclude the XRAY issue types (e.g. Test) from the automation. In other words when all of my Stories, Tasks, Bugs are done or resolved, I would like my Epic to also be marked as done, even thou there will be some tests linked to it that are not done or resolved.

 

Did any of you had such a challenge and managed to solve it?Capture.PNG

2 answers

1 accepted

2 votes
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.
March 20, 2023

Hi @Adam Ziecik 

What about using the JQL (or related issues) condition to find all issues with the same parent, and which are not issueType Test, and which are not done?  If there are none, proceed to transition the epic.

Generally, if you can write JQL to answer a question, a rule can use that JQL for deciding actions.

Kind regards,
Bill 

Adam Ziecik March 22, 2023

@Bill Sheboy Thank you for responding. Could you shed a bit more light on this possible solution. I have tried using JQL and related issues conditions but it did not work. Maybe I used it incorrectly. Also, how could I find all issues with the same parent and add this to an automation when the parent is not a specific parent?

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 22, 2023

When creating JQL for use in a rule, it can help to create it stand-alone first using a specific example, in advanced issue search.  Then change it to be generic using a smart value.

From what you described, you could try this in the rule (substituting in your project name):

project = myProjectName AND Parent = {{triggerIssue.parent}} AND issueType != Test AND statusCategory != Done

And testing the condition "Are not present" to confirm there are none.

Also, I am using Jira Cloud, so please substitute "Epic Link" for "Parent" if that is what your version of Jira is using for the Epic -> Child issue relationship.

Adam Ziecik March 27, 2023

@Bill Sheboy - thank you again for responding.

 

When I try to use this JQL in Jira Automation Project rules:

parent = {{triggerIssue.parent}} AND issueType not in (Test, "Test Plan","Test Set","Test Execution", Sub-task) AND statusCategory != Done

 

it transforms it to the following one with the error displayed below:

 

"(("cf[12859]" = ABCD-2688 or (parent = ABCD-2688 and issuetype in standardIssueTypes())) AND (project = "ABCD" AND parent = AND issueType not in (Test, "Test Plan","Test Set","Test Execution", Sub-task) AND statusCategory != Done)) AND (project in (21259))" - Error in JQL Query: Expecting either a value, list or function but got 'AND'. You must surround 'AND' in quotation marks to use it as a value. (line 1, character 133)
When I try to filter for parent = ABCD-2688 then I get no results even though there are standard issues that have the ABCD-2688 as an Epic.
Any idea what am I doing incorrectly?
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 27, 2023

Interesting...let's be even more specific with this, adding the key to the parent check:

parent = {{triggerIssue.parent.key}} AND issueType not in (Test, "Test Plan","Test Set","Test Execution", Sub-task) AND statusCategory != Done

Adam Ziecik March 28, 2023

@Bill Sheboy - unfortunately, the same is still occurring and gives the same error:

 

"(("cf[12859]" = IMASC-2688 or (parent = ABCD-2688 and issuetype in standardIssueTypes())) AND (parent = AND issueType not in (Test, "Test Plan","Test Set","Test Execution", Sub-task) AND statusCategory != Done)) AND (project in (21259))" - Error in JQL Query: Expecting either a value, list or function but got 'AND'. You must surround 'AND' in quotation marks to use it as a value. (line 1, character 107)
Any idea what may be wrong?
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 28, 2023

No idea, as just parent should have worked.

Would you please post images of your current rule and of the audit log details showing the execution?  Perhaps we are missing some context by only looking at part of it.

And just to confirm, you are using Jira Server (or Data Center), correct?

Adam Ziecik March 30, 2023

@Bill Sheboy - Yes, we are on Data Center.

Here is the Automation:

Capture.PNG

And the error: 

Capture2.PNG

Project key is the same in all as this is an automation on a project level.

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 30, 2023

Let's try creating a new rule, avoiding any possible things broken under the hood for this one.  After creating the rule, let's see what happens.  Rules can get glitched if they are edited too many times...I have no idea why.

  • trigger: issue transitioned to Released, Removed, Fixed, or Done
  • branch: to parent epic
    • action: write to the audit log {{issue.key}} is the parent of {{triggerIssue.key}}
    • condition: status equals In Progress
    • related issues condition: with JQL...
      • JQL: project = yourProjectName AND parent = {{issue.key}} AND issueType NOT IN (Epic, Test, "Test Plan", "Test Set", "Test Execution", Sub-task) AND statusCategory NOT IN (Done)
      • Condition: Are not present
    • action: transition to Done
Adam Ziecik April 3, 2023

@Bill Sheboy - thank you again for your input - it is much appreciated!

I have implemented the automation as you instructed, but the problem with it is that it will transition the Epic to Done when any Story is transitioned to Done, even though there are other Stories that are still not done. What I was trying to achieve is that the transition of Epic to Done will only happen when all of the standard Jira issues  (e.g. Stories) will be done  and exclude the XRAY issue types from this automation rule. Do you have any idea how this could be achieved?

Capture3.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.
April 3, 2023

That seems to indicate a problem with the related issues condition, or its JQL.

Have you tried to use the JQL with an example epic to get it to work how you want, and then try that in the rule for the condition?

Adam Ziecik April 4, 2023

@Bill Sheboy - you are correct, it is the part of JQL parent = {{issue.key}} that did not work. Instead I have used "Parent Link" = {{issue.key}} and it works as it should. Thank you very much for all of your support.

Like Bill Sheboy likes this
0 votes
Adam Ziecik March 20, 2023

@Bill Sheboy - do you think you could help here?

Suggest an answer

Log in or Sign up to answer