Hi Community,
My use-case is:
A Parent issue transitions from Open status to three different Statuses (Prioritized, Not-Prioritized, or Cancelled) based on it's Child Issues' statuses.
Per my configuration:
I need help to run a logic using Nunjucks in Child Workflow - Transition issue(s) Post-Function under Advanced options > "Run this post-function only if a condition is verified" checkbox.
Any sample code or relevant help document on Nunjucks, will be a great help.
Thank you
Hi,
Thank you for your question! I’m Paweł, a Customer Success Manager here at Appfire. I'm happy to help.
In JMWE for Jira Cloud, you can use Nunjucks expressions in the "Transition issue(s)" post-function to automatically transition a parent issue based on the statuses of its child issues. Here’s a quick guide to get you started:
Go to Jira Settings → Apps
Under Jira Misc Workflow Extensions, click Event-based Actions
Click Create new action
Name your action something like Auto-transition Initiative based on child statuses
Under the WHEN section:
Event: Issue Transitioned
To Status: Choose specific statuses (e.g., Cancelled, Prioritized) or leave as Any
Click Save
Issue Type: Portfolio Epic (child issue type)
Projects: Select the applicable projects or leave as Any for all projects
Under THEN, click Select Post-functions
Choose Transition issue(s)
In the configuration screen:
Target Issue: Parent issue of the current issue in the Portfolio hierarchy
Transition: Use the Transition Picker to select the workflow used by Initiatives, then choose:
Move to Cancelled → All children are Cancelled
Move to Prioritized → All children are Prioritized
Move to Not-Prioritized → Mixed statuses
Under Advanced options, check:
Run this post-function only if a condition is verified
All children = "Cancelled"
{% set initiative = issue | initiative("key") %}
{% if initiative %}
{% set children = initiative | membersOfInitiative("status") %}
{% set allCancelled = true %}
{% for child in children %}
{% if child.fields.status.name != "Cancelled" %}
{% set allCancelled = false %}
{% endif %}
{% endfor %}
{{ allCancelled }}
{% else %}
false
{% endif %}
All children = "Prioritized"
{% set initiative = issue | initiative("key") %}
{% if initiative %}
{% set children = initiative | membersOfInitiative("status") %}
{% set allPrioritized = true %}
{% for child in children %}
{% if child.fields.status.name != "Prioritized" %}
{% set allPrioritized = false %}
{% endif %}
{% endfor %}
{{ allPrioritized }}
{% else %}
false
{% endif %}
Mixed Statuses → Move Parent to "Not-Prioritized"
{% set initiative = issue | initiative("key") %}
{% if initiative %}
{% set children = initiative | membersOfInitiative("status") %}
{% set statusNames = children | map(attribute="fields.status.name") | unique %}
{{ statusNames | length > 1 }}
{% else %}
false
{% endif %}
For a detailed walkthrough on setting this up, check out our guide:
Move parent to Done when all child issues are closed
And if you have any questions or need a hand along the way, feel free to reach out through our support portal. We’re always happy to help!
Cheers,
Paweł Mazur
Customer Success Team | Appfire
Hi @Paweł Mazur
Thank you for your message and for providing the recommended solution.
What I observed is that;
But in my scenario, there are three transitions coming out from Approved, to Prioritized, Not-Prioritized, and Cancelled.
When setting up the same configuration as mentioned above in:
OR
Even, I am unable to find any Logs which may have recorded this mismatch action on Child Workflow.
Could you help me further why Parent is not transitioning when it's Child(ren) has moved to next status?
I would also like to share additional conditions in my mentioned use-case:
There is a Custom Field 1 on Child Screen which is a deciding factor if Child should go to Prioritized, Not-Prioritized, or Cancelled.
So, additional Conditions are:
Please let me know if it is also possible via Nunjuck as I am able to run the Additional Conditions successfully using Groovy in Transition Issue Post-Function on all three transitions in Jira Data-Center.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same workflow in Parent Project (Initiative) and multiple Child Projects (Portfolio Epic) as below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Paweł Mazur
I tested one simple scenario where if all the children have moved to Prioritized, then only Parent should move to Prioritized by using this code on Move to Prioritized transition on Child Workflow:
{% set initiative = issue | initiative("key") %}
{% if initiative %}
{% set children = initiative | membersOfInitiative("status") %}
{% set allPrioritized = true %}
{% for child in children %}
{% if child.fields.status.name != "Prioritized:" %}
{% set allPrioritized = false %}
{% endif %}
{% endfor %}
{{ allPrioritized }}
{% else %}
false
{% endif %}
But Parent status didn't change when all the children have been moved to Prioritized
Execution log is showing:
Please guide further, and looking forward to hearing from you soon.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Digvijay,
Thank you for your detailed observations and for taking the time to test the solution. We're really glad to hear that it's working well in scenarios where there's only a single transition, such as Approved -> Prioritized.
I’d like to walk through your points and share some guidance on how to handle the more complex cases involving multiple transitions from the same status.
Your Observation
“The solution works fine with a single transition path but fails when multiple transitions are available from 'Approved'.”
Why this happens?
When a parent issue (like an Initiative) has more than one possible transition from the same status, say from Approved to Prioritized, Not-Prioritized, or Cancelled, you’ll need to create a separate Event-based Action or Post-function for each transition. Each one should have clearly defined, non-overlapping conditions.
This ensures that only one condition evaluates to true at a time, allowing JMWE to execute the correct transition reliably.
Common Pitfall
If none of the conditions evaluate to true, JMWE doesn’t throw an error—it simply doesn’t run any post-function. This is expected behavior. JMWE logs execution errors, but it doesn’t log condition mismatches. So if a condition evaluates to false, that step is quietly skipped.
For troubleshooting
A helpful tip: try temporarily outputting values such as
{{ children | length }}
This can give you visibility into what’s being evaluated in your logic.
Your Updated Requirements
Here’s how I understand your intended logic using the custom field:
1. Transition to Prioritized
If all child issues with Custom Field 1 = Yes are in Prioritized
– Ignore children marked as No or left blank
2. Transition to Not-Prioritized
If all child issues with Custom Field 1 = No are in Not-Prioritized
– Ignore those marked as Yes or blank
3. Transition to Cancelled
If all child issues with Custom Field 1 left blank are in Cancelled
– Ignore those marked as Yes or No
Let me know if that matches your intent.
A few clarifying questions
Also, if possible, could you share the Groovy scripts you’ve implemented in Jira Data Center? This would really help us validate and fine-tune the setup on our side.
Regarding the other error you encountered, we strongly recommend reaching out to us through our Support portal We’re diving pretty deep into the specifics of your setup, and we’d really prefer to continue the conversation in a space where we don’t need to share unnecessary logs or potentially sensitive information. It also allows us to loop in other JMWE team members and collaborate more effectively. It’s a much better environment for this kind of troubleshooting than a public forum.
Looking forward to your insights.
Kind regards,
Paweł Mazur
Customer Success Manager, Appfire
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Paweł Mazur
Thank you so much for your message and I would like to share the below details:
Should the parent issue automatically move from Open to Approved before checking for these transitions? Based on your workflow, it looks like Prioritized, Not-Prioritized, and Cancelled all branch from Approved, so this step might be necessary.
Parent should move to Not-Prioritized based on below:
C1 > C2 > C3 > P1
1) Not-Prioritized > Not-Prioritized > Not-Prioritized > Not-Prioritized
2) Not-Prioritized > Not-Prioritized > Cancelled > Not-Prioritized
3) Not-Prioritized > Cancelled > Not-Prioritized > Not-Prioritized
4) Cancelled > Not-Prioritized > Not-Prioritized > Not-Prioritized
5) Cancelled > Cancelled > Not-Prioritized > Not-Prioritized
6) Cancelled > Not-Prioritized > Cancelled > Not-Prioritized
7) Not-Prioritized > Cancelled > Cancelled > Not-Prioritized
Parent should move to Cancelled based on below:
C1 > C2 > C3 > P1
1) Cancelled > Cancelled > Cancelled > Cancelled
Rest on all other Child(ren) conditions, Parent should transition to Prioritized
What should happen if none of the child issues qualify for any of the transitions? Should the parent remain in Approved, or is there another fallback action you'd like to see?
First C1 Moved > Second C2 Moved > Third C3 Moved > Then P1 Moves
1) Prioritized > Prioritized > Prioritized > Prioritized
2) Cancelled > Prioritized > Not-Prioritized > Prioritized
3) Not-Prioritized > Cancelled > Not-Prioritized > Not-Prioritized
4) Prioritized > Not-Prioritized > Approved (C3 didn't move) > No Parent Transition
Regarding Groovy script:
I am running multiple if-elseif-else conditions of Children statuses on each Transitions from Approved to Prioritized, Not-Prioritized and Cancelled on Child Workflow. It will be hard to write here, I'll share the complex code in the Support Ticket.
However, I am still want basic/ sample code using Nunjucks which can satisfy the above use-case as I want to build if-elseif-else concept around it and will share the same with your team if I am stuck somewhere.
May you guide me further?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Suprija Sirikonda _Appfire_
May you guide me with my above use-case on how can I achieve the same using nunjuck in transition issue post function? As I am new to Nunjuck functionality.
Thanks in advance.
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.