Hello, Guys!
I want to create two custom fields:
- the sum of estimated time of all linked issues to this task.
- the sum of logged time of all linked issues to this task.
For the above two purposes I use the following link:
https://scriptrunner.adaptavist.com/latest/jira/recipes/scriptfields/workRemainingInLinkedIssues.html
However, the time is not calculated.
My link name is "Composition"(I've attached an image "Link type - composition") like in the example:
https://scriptrunner.adaptavist.com/latest/jira/recipes/scriptfields/workRemainingInLinkedIssues.html
However, there is no calculated time(attached image of field "").
Could you clarify what I am doing wrong?
We want to buy ScriptRunner, but we would like to learn how to use it before we buy it.
Thanks in advance!
In addition, I've attached my code.
Link type is:

No calculated time in field "Sum logged time of linked issues":
My code is:
package com.onresolve.jira.groovy.test.scriptfields.scripts
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def totalRemaining = 0
issueLinkManager.getOutwardLinks(issue.id).each {issueLink ->
if (issueLink.issueLinkType.name == "Composition") {
def linkedIssue = issueLink.destinationObject
totalRemaining += linkedIssue.getEstimate() ?: 0
}
}
// add the remaining work for this issue if there are children, otherwise it's just the same as the remaining estimate,
// so we won't display it,
if (totalRemaining) {
totalRemaining += issue.getEstimate() ?: 0
}
return totalRemaining as Long ?: 0L