Performance Problems Calculated Number Fields

We have a calculation based on different custom fields to show the business value of an issue. sadly the formula is not very performant. the formula is:

<!-- @@Formula:
var a = 0.3; // Strategical alignment (sa) and Revenue potential (rp) are weighted 30%
var b = 0.2; // Saving potential (sp) and competitive advantage (ca) are weighted 20%
var x = 2; // Is the factor for the weight of "business value" (bv) in the model
var y = 1; // Is the factor for the weight of the "loss of value" (lv) in the model
var z = 1; // Is the factor for the weight of the "capacity increase" (ci) in the model
//Variables for business value
int sa = (issue.get("customfield_11631") != null ? Integer.parseInt(issue.get("customfield_11631").toString()) : 0);
int rp = (issue.get("customfield_11632") != null ? Integer.parseInt(issue.get("customfield_11632").toString()) : 0);
int sp = (issue.get("customfield_11633") != null ? Integer.parseInt(issue.get("customfield_11633").toString()) : 0);
int ca = (issue.get("customfield_11634") != null ? Integer.parseInt(issue.get("customfield_11634").toString()) : 0);
var bv = (sa+rp)*a + (sp+ca)*b;
//Variables for loss of value over time
int lv = (issue.get("customfield_11635") != null ? Integer.parseInt(issue.get("customfield_11635").toString()) : 0);
//Variables for capacity increase
int ci = (issue.get("customfield_11636") != null ? Integer.parseInt(issue.get("customfield_11636").toString()) : 0);
//Variables for investment
int in = (issue.get("customfield_11637") != null ? Integer.parseInt(issue.get("customfield_11637").toString()) : 0);
//WSJF calculation
var wsjf = (x*bv + y* lv+ z*ci)/in;

return wsjf;


we thought about converting it to something like:

<!-- @@Formula:
function q(e){return


But then it's not working an the log is full of errors because obviously characters like the + or functions are not allowed.

Is there a solution to raise the performance or a documentation what kind of script (it's not real javascript, right?) we can try to use instead?


thanks in advance 



1 answer

First of all, the syntax supported in Calculated Field formulas is BeanShell. It supports creating classes and methods, just like the Java language it closely resembles.

Then, how did you find out that you had performance issues? 

One very easy way to double performance would be to store the value of each field you are referencing in a variable instead of accessing it twice using issue.get(). For example:

var val = issue.get("customfield_11631");
int sa = (val != null ? Integer.parseInt(val.toString()) : 0);

Then, another cause of performance issues could be related to the fields you are accessing in the formula. What type of fields are they?

thanks for the hint with the double access by using issue.get twice. going to try that out. the fields we use are configurated as a select list (single choice) = dropdowns with numbers 1-10

This does not explain why the calculated field is so slow. How did you measure performance?

Measured it with Chrome Console - the Jira page loads fine within 1.3-1.9s but then there is a gap until Jira Agile Content is loaded and viewable around 8-9s. See Answer below with the screenshot.

I don't see the Answer below with the screenshot... Also, if you try to modify the formula to just "return 1;" , does it solve your performance issue? If not, then it means the problem does not lie with this custom field...

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

820 views 5 17
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot