Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JMWE Cant set issue field although tester gives result

Hi everyone,

I want to write a event-based action. Let me give some detail.

A is linked to B through relates to. C is the sub-task of the B. When a x field changes in C, I want to sum all x fields in B's subtasks and write the result a y field of A.





Although tester gives me the right result, it does not reflect on A's y field. What am I missing?


Below the details of my event based action;event.png

1 answer

1 accepted

0 votes
Answer accepted

Hi @Aslıhan Paksoy 

the biggest issue is with the Value Nunjucks template for the Set Issue Fields post function:

  1. the parentIssue variable is not available in this context
  2. since you have configured Target issues ("Issue(s) to operate on"), the Nunjucks template is evaluated for each target issue, and the target issue is available in the targetIssue variable. The Nunjucks template must therefore iterate over each linked issue, and then over each sub-task of the linked issue(s).

The right Nunjucks expression is:

{% set total = 0 %}
{% for linkedIssue in targetIssue | linkedIssues("relates to", ["subtasks"]) %}
{%set total = total + (linkedIssue | subtasks("customfield_10205") | field("fields.customfield_10205") | sum) %}
{% endfor %}
{{ total }}

You might also want to select your sub-task issue type(s) in the "Scope" section, for better performance.

This is excellent!It works, thank you so much 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

408 views 19 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you