Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,450
Community Members
 
Community Events
176
Community Groups

Calculate and display the total logged time under an Epic (Epic + Issues in Epic)

Hi dear community, 

I'd need your help to find an alternative solution to a scripted custom field (Epic Time Spent) that was implemented with the 3rd-party app ScriptRunner; we won't have this application available in our new Cloud environment. 

This is the Groovy script that is currently used to calculate and display the total logged time of an Epic and all the issues within it (in hours): ⬇️

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager

Issue epicIssue = issue

if (epicIssue.getIssueType().getName() != "Epic") {
return null
}

IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager()

Long timeSpent = 0
if (epicIssue.getTimeSpent()) {
timeSpent = timeSpent + epicIssue.getTimeSpent()
}
epicIssue.getSubTaskObjects().each { subIssue ->
if (subIssue.getTimeSpent()) {
timeSpent = timeSpent + subIssue.getTimeSpent()
}
}
issueLinkManager.getOutwardLinks(epicIssue.getId()).each { epicLink ->
if (epicLink.getIssueLinkType().getName() == "Epic-Story Link") {
Issue epicLinkedIssue = epicLink.getDestinationObject()
if (epicLinkedIssue.getTimeSpent()) {
timeSpent = timeSpent + epicLinkedIssue.getTimeSpent()
epicLinkedIssue.getSubTaskObjects().each { subIssue ->
if (subIssue.getTimeSpent()) {
timeSpent = timeSpent + subIssue.getTimeSpent()
}
}
}
}
}
if (timeSpent == 0) {
timeSpent = null
}
return timeSpent

Are you aware of any native solutions we could use, instead?

Or maybe a new customisation using Automation for Jira / JMWE? 

Appreciate any help! 🙏 

3 answers

1 accepted

0 votes
Answer accepted

Posting what I came up with to solve our use case (using only native functionalities + Automation for Jira), it might be useful for someone with a similar use case 🤞 

Epic time spent.png

The variable is not strictly needed to achieve this, but I'll have to expand the automation so I've left it there.

Hi

Thanks for the above rule, but this rule is not working when timelogged for subtask in the stories, Epic timelog is not updating. Do you have any suggestion here?

0 votes

Hi @Giulia Caberlotto 

I've noticed you are looking for a solution that doesn't need any expenses. Maybe you will be interested in out app Teamlead: EpicTime for Jira - SumUp of Worklogs.

It's free for teams that are up to ten users.

unnamed.png

EpicTime sums up work logs of child issues to the epic. Also, you can view the following information within Epic's issues:

  • Epic Estimate
  • Epic Time Spent
  • Epic Remaining
  • Epic Ratio (percentage of the spent time)

unnamed (1).png

A variety of reports provides data about time results for all epic issues.

0 votes
Bloompeak Support Marketplace Partner Jun 16, 2022

Hi @Giulia Caberlotto ,

You can try Reports - Charts and Graphs for Jira app developed by our team to create various reports, charts and graphs for your Jira projects.

Here is a sample report that shows sum of time spent by epic.

Sum of Time Spent By Epic.png

  1. You first define your data source, it can be projects or custom JQL you type.
  2. Set Y-Axis, in your case Sum of Time Spent in hours
  3. Set X-Axis, in your case Epic. 

Below you can see an article about creating custom reports, charts and graphs in Jira with our app.

How to Create Custom and Flexible Reports, Charts and Graphs in Jira

Here is our live demo dashboard where you can see and modify sample reports and play with them.

Hope it helps.

Hi! Thanks for the suggestion.

We’re aware that this could be calculated via 3rd party apps like yours, however, this is not budgeted at the moment and we're looking for a different solution, as we'd also need to display the Epic Time Spent field within the epic. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events