Hi,
I'm looking for help with creating a custom field that pulls in the value of "Original Estimate" on any issue based on the Assignee and Sprint of that issue.
Ex. Johnny has a Capacity issue with a "Total Hours of Work" field that needs to pull in the total hours of all issues assigned to him during Sprint 1.
So the "Total Hours of Work" field on the Capacity issues should 17 hours based on the original estimate from all issues combined.
Code to pull in the total hours of Sub-tasks and Story:
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 / 60
}
Any help is much appreciated!
Thanks,
Matt
Hi @Matthew_Schulz ,
You can compose a JQL inside ScriptRunner and return the result that you need, you can then loop it to get the total hours of all result of JQL.
https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html
Hi @brbojorque ,
Great idea! But I'm pretty new to Jira, is there a way to query for all issues that belong to an issue by Assignee and Sprint dynamically? It wouldn't really work if we have to add each person in by hand.
Thanks,
Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Matthew_Schulz , your problem is very interesting, let me get back to you with a full script.
This is a good idea for keeping the defined/easy to keep track hours per sprint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Matthew_Schulz ,
Come to think of it, you can actually use the Workload Pie Gadget if you are using the server version of JIRA.
My sample JQL for the filter and you can group it by assignee
project = SP and Sprint = openSprints()
You will see in the gadget what is the estimates or time spent,
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.