The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Sum of Estimated hours on Linked stories under EPIC

chithra madhav
February 28, 2022

Hi ,

I have an Epic & i have linked multiple existing stories in it.
I need to create a Calculated scripted field from which Estimations of all stories linked in Epic should be summed & display it.
I also have an scripted field for Stories which calculate the sum of all tasks & sub-tasks linked with the stories & provides expected result

I tried to invoke that field in this Epic Script ,to calculate & generate output but it results as 0.


Please find below Script & help me on this requirement ASAP

Script Used-->//Scripted field-->Stories linked with Epic --Original estimate Calculation

import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
double totalestimate = 0
customField = cfManager.getCustomFieldObject("customfield_14126");

//customField1 =cfManager.getCustomFieldObjectsByName()
log.debug(customField)

if (issue.getIssueTypeId() != "10000") {
return null
}
issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->;
if (issueLink.issueLinkType.name == "Epic-Story Link" ) {
def linkedIssue = issueLink.destinationObject
log.debug(linkedIssue)
double originalestimate =(double)(linkedIssue.getCustomFieldValue(customField) ?: 0)
log.debug(originalestimate)
totalestimate = originalestimate + totalestimate;

}}



Thanks in Advance

Regards,
Revathy Madhavan

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
chithra madhav
September 3, 2024

Hi ,

Any update on the above request?

Regards,
Revathy Madhavan

chithra madhav
October 21, 2024

Hi All,

Any update on the above request

Regards,
Revathy Madhavan