How can I access with groovy the subtasks of linked issues?

Anita Hütter May 16, 2021

We are working with Jira Server and JMWE plugin.

We have created an issue type that stand in the hierarchy above the epic- what means this issue type "abc" hast always more than one linked Epic inside.

Now we have a transition in epic workflow to sum up all storypoints from all issues inside the epics.

Also we have a transition to sum up all storypoints of all linked epic.

But always you have to update first the epic and after you can make the update in abc

My question is: Is there a possibility to make it in one step out of abc?

Is it possible to access the subtasks of linked issues?

 

4 answers

2 accepted

0 votes
Answer accepted
Anita Hütter May 24, 2021

Thank you very much for your help!

Suprija Sirikonda _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2021

You are welcome!

-Suprija

0 votes
Answer accepted
Suprija Sirikonda _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2021

Hi @Anita Hütter ,

Using JMWE, to set the Story Points field value of an issuetype(say "abc") to sum of the Story Points field value of all the tickets which belong to the Epics linked to the "abc" issue : 

  • Add a “Set field value (JMWE app)” post-function on the desired transition of the "abc" issuetype
  • Select “Story Points” field
  • Select “Value Type” as “Groovy Expression” and add the below Value :
issue.linkedIssues.findAll{it.issueType.name == "Epic"}.stories.sum{ it.sum {it.get("customfield_10006", 0)} }

Replace customfield_10006 with the id of "Story Points" field.

The above script finds the Epics linked to the current issue(through any link type) and sums the Story Points value of all tickets which belong to the Epics.

JMWE.png

 

We have opened a support ticket in our customer portal, https://innovalog.atlassian.net/servicedesk/customer/portal/8/SJMWE-2663 to better track your request and added you as the reporter for that ticket. Please access the ticket and make sure that it is accurately showing you as the reporter.

If you need us to make any changes to the reporter field or unable to access the ticket, please let us know here in this thread.

 

Thanks,

Suprija

Nick H October 27, 2022

Suprija, I have a similar issue where we have sub-tasks related to a issue. On the subtasks users enter a number of hours (number field) that it took them to complete the sub task. Could this script be modified to look at an issues' subtasks, look at that custom field, and sum the entries? Both the parent issue and subtasks are custom issue types if that matters at all? 

0 votes
Anita Hütter June 2, 2021

Hello Suprija, how can it be that your script

issue.linkedIssues.findAll{it.issueType.name == "Epic"}.stories.sum{ it.sum {it.get("customfield_10006", 0)} }

runs good in our test instance but causes the following exception in the other:

Message:
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Double#plus.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
 [class java.lang.Character]
 [class java.lang.String]
 [class java.lang.Number]
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 2, 2021

Different versions of Jira or Java on the two systems are the most likely cause of this, although it may also be down to different code in an app, if the code is looking at app data.

Anita Hütter June 7, 2021

in the one instance we have JMWE 6.4.0 -> hats where the script is working

in the other instance ( where I need it to be running) we have JMWE 6.6.1 - here it doesnt run

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 7, 2021

I believe the script should be:

issue.linkedIssues.findAll{it.issueType.name == "Epic"}.sum{it.stories.sum{it.get("customfield_10006", 0)} ?: 0 }
Like # people like this
Anita Hütter June 7, 2021

After first tests it looks good. Thank you very much for your help!

 

Anita Hütter June 7, 2021

Its working with both versions of JMWE thanks!

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 24, 2021

Please remember, when you are looking at the sub-tasks, putting estimates on them breaks your sprint and stops you doing them.  It's fine to put story points or estimates on sub-tasks, as long as you do not use them for the sprint estimation statistic.

Suggest an answer

Log in or Sign up to answer