I'm looking to create a new jira issue type to enable me to have an issue that holds project health information. In this, I would like a number of custom fields that pull infomation in from across all issues in the project.
I want to create a custom field (e.g. SIL script) for each of the following from all issues in the project:
sum of logged time
sum of original estimate
sum of time remaining
This can be used to estimate %progress for instance
Does anyone know of a SIL or perhaps a Scriptrunner script can do this?
Thanks
I recently wrote a very similar script for a client, so here's a freebie for ya! Instead of adding a comment at the end of the script, you'd just have to make a few mods to set values in your specific custom fields.
The trick is figuring out when to invoke this script. I used SIL Listeners w/ Power Scripts to run this script when an issue is created, issue is updated, or work is logged on an issue. You might consider Live Fields on relevant screens as an alternative.
/* This script will run whenever an issue is created, updated, or work is
logged on an issues in the applicable project.
*/
string projectInScope="PRDT"; // the project you want to sum up
string masterIssue="PRDT-45"; // issue where you want to capture this info
if(project==projectInScope) { // if invoked via listener, limit the scope
string jql="project="+projectInScope;
string [] allProjectIssues=selectIssues(jql);
string issue;
string commentText;
interval sumOriginalEstimate;
interval sumTimeSpent;
interval sumTimeRemaining;
number hoursOriginalEstimate;
number hoursTimeSpent;
number completePercent;
number countIssues=0;
for(issue in allProjectIssues) {
sumOriginalEstimate += %issue%.originalEstimate;
sumTimeSpent += %issue%.timeSpent;
countIssues +=1;
}
sumTimeRemaining = sumOriginalEstimate - sumTimeSpent;
hoursTimeSpent = sumTimeSpent;
hoursOriginalEstimate = sumOriginalEstimate;
completePercent = round((hoursTimeSpent/hoursOriginalEstimate)*100,0);
string commentTextA = "This project has *"+sumOriginalEstimate+"* estimated work";
string commentTextB = " with *"+sumTimeSpent+"* spent for a total of *";
string commentTextC = ""+sumTimeRemaining+"* hours remaining. ";
string commentTextD = "It is *"+completePercent+"%* complete.";
commentText = commentTextA + commentTextB + commentTextC + commentTextD;
addComment(masterIssue, currentUser(), commentText);
}
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.