Switching epic automatically to done, if all linked issues are done.
Hello Fidel,
first of all, I'm a JIRA beginner :) So please don't treat me for stupid questions.
My problem: I've got epics with different linked issue types (tasks, requirements and tests). Each of this issue type has a different workflow with different status. I want the epic to switch automatically to "Done" if all the linked issues are in their "final" status.
I already solved the problem with post function, but only for one issue type. Logically this solution won't work as soon as a different workflow/issue type is added.
How can i solve d´this problem?
Cheers,
Steffen
Comments (15)
-
repo owner -
reporter The final status should be the 2nd one, so that the issue is considered finished.
Note: Please don't ask me (perhaps you can explain it to me?) why I have to subtract 1 .... ;) And please ignore "Validated", it was a try to solve this issue.
-
repo owner Hi @Steffen1305,
Sorry, but I don't understand what you mean by "The final status should be the 2nd one...". Do you mean that final statuses are those with Done status category?
In relation with
- 1
in the expression: You are inserting the post-function in child issue's final transition. When the last child issue is being moved to final status, all the sibling child issues are already in final status, but current one is not yet, that's why we have to subtract 1 from the total number of child issues. -
reporter Yes, the final status are those with Done status category.
When the last child issue is being moved to final status, all the sibling child issues are already in final status, but current one is not yet, that's why we have to subtract 1 from the total number of child issues. Okay, this makes sense! Thanks.
-
repo owner Hi @Steffen1305,
You can do it using the following boolean expression at parameter "Filtering by field values:":
count(filterByFieldValue(linkedIssues("is Epic of", ^%{00015}), %{00144}, =, "Done")) = count(linkedIssues("is Epic of", ^%{00015})) - 1
where
%{00015}
is field code for issue key,%{00144}
is field code for issue status category, and"Done"
is a string with the exact name of the status category of final statuses. -
reporter Unfortuneatly this doesn't work :( I thought %{00015} is the field code for issuekey ? Issuestatus should be {00016} but in my understanding issuekey should be the right parameter.
For my understanding:
linkedIssues("is Epic of", ^%{00015}) lists all issues under the same epic like current issue
filterByFieldValue(xxx, %{00144}, =, "Done") filters the above list due to Status Category= Done
For me this should work, but it isn't.
-
repo owner Hi @Steffen1305,
Let's do some debug: use "Copy a parsed text to a field" post-function with the following configuration in order to get the values returned by the 2 terms of the expression:
- Target field: New comment
- Parsing mode: advanced
- Text to be parsed...:
"Closed issues: " + toString(filterByFieldValue(linkedIssues("is Epic of", linkedIssues("has Epic")), %{00144}, =, "Done")) + "\nAll issues: " + toString(linkedIssues("is Epic of", linkedIssues("has Epic"))
Share with me the comment you obtain.
-
reporter Hi Fidel, in your code is an error and I'm not able to fix it. I tried the first part of the code to see "Closed Issues" but the comment is empty like: "Closed Issues: ............"
-
repo owner Hi @Steffen1305,
Use the following string expression:
"Closed issues: " + toString(filterByFieldValue(linkedIssues("is Epic of", linkedIssues("has Epic")), %{00144}, =, "Done")) + "\nAll issues: " + toString(linkedIssues("is Epic of", linkedIssues("has Epic")))
-
reporter Now it works :)
-
repo owner Hi @Steffen1305,
You are not getting any issue at "Closed issues:". The only 2 reasons I can think of are:
- You don't have any issue child issue in a "Final" status. In that case, please, try again ensuring that you have a pair of issues in "Final" status. Share the comment again with me.
- You are not writing correctly the status category in your expression. In my expression I used
"Done"
, but you should use exactly the name in your JIRA instance. You can check up the name of the status category at Administration > Issues > Statuses.
-
reporter Okay, the Status category was wrong.
-
repo owner Now, use that same status category in boolean expression at parameter "Filtering by field values:":
count(filterByFieldValue(linkedIssues("is Epic of", ^%{00015}), %{00144}, =, "Done")) = count(linkedIssues("is Epic of", ^%{00015})) - 1
-
reporter Thanks a lot for your Support!!! The Problem was the status category, again lost in translation
Cheers, Steffen
-
reporter - changed status to resolved
- Log in to comment
Hi @Steffen1305,
Your question is very interesting. Please, attach a screenshot of the post-function you have configured.
Can we use any of the following criteria to find out "final" statuses?
Status Category is a special attribute of statuses you can define. Look at the screenshot: