Hello,
I'm having troubles getting my "Transition linked issues" post-function to properly work.
Here is what I intend to do:
Setup:
Use Case:
A user logs a (parent) issue in the "Head" project that impacts let's say systems A, B and C. (child) Issues are automatically created in the "System" projects A, B and C and are linked to the (parent) issue in the "Head" project with the above custom link type (This works like a charm thanks to JMWE!).
Hence, we end up with 4 issues in 4 different projects:
Now I want to automate the "parent" issue transitioning from "To Do" to "In Progress" when AT LEAST ONE of its "child" issues reaches workflow step 2 (In Progress), and from "In Progress" to "Done" when ALL (the last) of its "children" reach workflow step 3 (Done) - knowing that at that time one or more of these issues might already be in step 4 (Closed).
My first (unsuccessful) try at this:
Not knowing how to tackle the AT LEAST ONE case, I started with the ALL case that benefit from a closely related documented setup (Epic/Stories transitioning):
{% set children = issue | linkedIssue | linkedIssues("is parent of") %}
{% set trigger = true %}
{% for child in children %}
{% if child.fields.status.name != "Done" %}
{% set trigger = false %}
{% endif %}
{% endfor %}
{{ trigger }}
>> I gave it several tries and... nothing happens at the Parent issue-level.
First off, has anyone an idea of what I'm doing wrong here / already tried this / know how to make it work? Second, does someone know how to adapt it to the AT LEAST ONE case?
Many thanks in advance to whomever will take the time to help me on this!
Best,
Severin
Hi Severin,
There is a small error in your conditional execution script. It should be:
{% set children = linkedIssue | linkedIssues("is parent of") %}
{% set trigger = true %}
{% for child in children %}
{% if child.fields.status.name != "Done" %}
{% set trigger = false %}
{% endif %}
{% endfor %}
{{ trigger }}
You should also add a small (2-second) delay to the post-function to make sure the current "child" issue is done transitioning to Done.
As for the "at least one" use case, you don't need any condition, since the transition linked issues post-function will be on the "start progress" transition of the child issue, so at least that chile issue is guaranteed to be "in progress" by the time the transition linked issues post-function runs. Also, if the parent issue is not in the To Do status, the "start progress" transition won't be available so the transition linked issues post-function will do nothing.
Hello David,
Works perfectly with your correction! I couldn't have spotted it! Thank you very much! Nunjucks syntax and logic do not always appear very straightforward to me..
As for the "at least one" use case that's also what I thought but I was worried to flood the logs with warnings/errors because of JMWE not finding the transition available.. I added a basic condition to not trigger if the parent is already in the desired state, just for the sake of keeping it clean..
Thanks again!
Severin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.