Hi Guys,
Does anyone know how to calculate sum of a custom number field from all epics to their initative? I tried ScriptRunner and JMWE. JMWE seems more simple. But I cannot get the right value. It always return NAN.
Here is the case:
We use advanced roadpmap in our jira cloud. Use the Initiative and Epic types. Added a custom number field: Score. Want to calculate sum of Score in all epics automaticlly.
- TIS-1 Initiative issue: (Score: <Empty>)
|----TIS-2 Epics issue No.1 (Score: 11)
|----TIS-3 Epics issue No.2 (Score: 22)
|----TIS-4 Epics issue No.3 (Score: 33)
|----TIS-5 Epics issue No.4 (Score: 44)
Use Event-based Actions in JMWE:
Current issue: TIS-2
Target issue: TIS-1
{{issue | initiative()|membersOfInitiative("Score")|sum("Score")}}
Always return: NaN
BTW: If you have any suggestion by ScriptRunner, please don't hesitate to comment!!
Thanks in advance!
Resolved my question by https://community.atlassian.com/t5/Jira-Software-questions/JMWE-sum-array-not-summing-array/qaq-p/1511608#U1652205
Here is what I did:
(customfield_10047 is the ID of "Score", customfield_10018 is the ID of "Parent Link")
{% set values = ("'Parent Link' = " + issue.fields.customfield_10018.data.key) | searchIssues(fields = "customfield_10047") | field("fields.customfield_10047") %}
{% set total = 0 | int %}
{% for val in values %}
{% set total = total + (val | int) %}
{% endfor %}
{{total}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.