Give issues a value based on it's priority, sum them all up and divide against a fixed value Edited

I am supposed to automate the calculation of something we refer to as "Bug Score". This value is used to determine how good we are at finding bugs before release. We want to see this value in a Dashboard.

Currently we calculate it this way:

Bug score = 100*(blocker) + 50*(critical) + 25*(major) +5*(medium) + 1*(minor + trivial) / (707 * 100)

For example: a bug report with priority "Blocker" will get a value of 100 and one with "Critical" 50 and so on. These are summed up and divided by 707 which is a fixed value we decided on at some point in time.

This only applies to bugs which have status "Open" or "Reopened" and are flagged as "Is customer reported?" (this is a custom field).

I was thinking I could create a custom field which can check it's own priority and then set the value accordingly and then have some Dashboard widget to the sum up all bugs flagged as customer reported and do the division. But I wouldn't know how to actually do this.

I feel there is some help in these earlier questions:

2 answers

1 accepted

1 vote
Accepted answer

You can use the JIRA Misc Custom Fields add-on to achieve the same.

It's difficult to write a fully-working formula without knowing the exact details of your instance, but to give you a rough idea:

<!-- @@Formula:
var priority = issue.get("priority").getName();
var customerReported = issue.get("Customer Reported") != null && issue.get("Customer Reported").size() > 0;

if (!customerReported) return null;

if (priority.equals("Blocker") return 100;
if (priority.equals("Critical") return 50;
if (priority.equals("Major") return 25;
if (priority.equals("Medium") return 5;
return 1;

And the filter of Open or Reopened issues will be done at the dashboard widget level.

Terribly sorry for the late reply but I have been over my head in other work

I get an error in catalina.out. It seems it does not like the returns when checking priority. Not sure why though:

2017-06-27 14:53:26,459 http-bio-8080-exec-268 ERROR <username> 893x2262270x2 1erjiom <ip1>,<ip2>, /secure/EditAction!default.jspa [innovalog.jmcf.fields.CalculatedNumberField] CalculatedNumberField: error evaluating formula of field "Bug score value" of issue <issue-id>: 
Parse error at line 8, column 32. Encountered: return
Navigate to the following URL to edit the formula: <url>/jira/secure/admin/EditCustomField!default.jspa?id=12870

 Thanks for all the help so far!

There was a missing parenthesis in those lines. Now it works! Can't believe I missed it. :)

0 votes

You are right, you can implement this fairly trivial custom field using the ScriptRunner add-on.


Then you can sum up scores with the 2D Filter Results gadget.

Terribly sorry for the late reply but I have been over my head in other work. Thanks for the reply. I am currently trying out JIRA Misc Custom Fields.

Much appreciated!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

90 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you