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

JIRA tally all logged work from linked issues and sub tasks to single issue

I have tried several different groovy script methods form various examples as I am not a coder, but have come close but no real success. I have thrown my hands up and am wondering if some smart person out there knows how to do this.

I simply need to show all total work logged for a specific link type of parent issues and their sub tasks to a single issue as a grand total. See diagram.Untitled Diagram.png

1 answer

1 accepted

When you say groovy script methods it's a bit ambiguous what you are trying to do exactly, but, if I understood this right I've set it up with a Script Field which fingers crossed gets you closer.


This seems to work in my tests and I'm getting expected values on the Asset Record in your pic:

// Template: Duration (either of the 2)


def issueLinkmanager = ComponentAccessor.getIssueLinkManager()
def subtaskManager = ComponentAccessor.getSubTaskManager()
def workLogManager = ComponentAccessor.getWorklogManager()

def linkName = "Work"

def linkCollection = issueLinkmanager.getLinkCollectionOverrideSecurity(issue)
def linkedIssues = linkCollection?.getOutwardIssues(linkName) //Inward or Outward? Verify and change if needed.

if (!linkedIssues) {
// no linked issues
return null

def totalTimeSpentFromWorkLinkedIssuesAndTheirSubtasks = []

for (def linkedIssue:linkedIssues) {
def worklogList = workLogManager.getByIssue(linkedIssue)
for (def worklog:worklogList) {
def timeSpent = worklog.getTimeSpent()

def subTasks = subtaskManager.getSubTaskObjects(linkedIssue)
for (def subTask:subTasks) {
def worklogListSubTask = workLogManager.getByIssue(subTask)
for (def worklogSubTask:worklogListSubTask) {
def timeSpent = worklogSubTask.getTimeSpent()

return totalTimeSpentFromWorkLinkedIssuesAndTheirSubtasks?.sum()


You're a genius, that worked like a charm.  No more head pounding.  Thank you so much, here is a virtual beer on me!

Also yes, we are using scriptrunner using a scripted field.

Suggest an answer

Log in or Sign up to answer

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