Hi folks,
I need a scripted field that adds up the remaining time estimates of the subtasks. I know JIRA does this automatically on the parent issues but I need that "Σ remaining estimate" value in an explicit field so I can export those values to our project management tool. I have ScriptRunner, we're on the server.
I assume I'll then need to create a listener that triggers a re-index on the parent issue when subtasks are edited, but I can do that separately.
I'm not a developer and I can't figure out what specific script I need to make this work - any help would be greatly appreciated!
Thanks,
Kelly
Thanks to Vasiliy Zverev I now have this script that does what I need - thanks for pointing me to those other threads!
import com.atlassian.jira.issue.Issue
long totalSum = 0;
for(Issue subtask: issue.getSubTaskObjects()){
if(subtask.getEstimate() != null)
totalSum += subtask.getEstimate()
}
return totalSum / 60
FWIW for future folks: I ended up tweaking the code so it now adds remaining estimates of all the subtasks as well as the remaining estimate on the story level ticket, or returns null if neither story nor subtasks have estimates. Final code below:
import com.atlassian.jira.issue.Issue
long totalSum = 0;
boolean noEstimates = true;
def totalSubTasks = issue.getSubTaskObjects().size()
for(Issue subtask: issue.getSubTaskObjects()){
if(subtask.getEstimate() != null){
totalSum += subtask.getEstimate()
noEstimates = false
}
}
if (issue.getEstimate() != null){
totalSum += issue.getEstimate()
noEstimates = false
}
if (noEstimates == true){
return null
}
else {
return totalSum / 60
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.