Code for Calculated Number Field


I am trying to create a calculated number field that will add the results of three new custom fields I have created.

The three new custom fields are all Number Fields:

Value to us (Custom Field Id 10502)

Value to customer (Custom Field Id 10503)

Value to general public (Custom Field Id 10505)

These fields are in each user story and the value is different and entered manually in each user story.

I have then created a custom Calculated Number Field "Total Value" from the add on Jira Misc, to show the calculation of the total value of the above fields (10502+10503+10505). I have typed the code into the description, but there appears to be something wrong.

I have checked out numerious Q&A pages about this issue and I have tried a few different formulas, this is the one that I am currently using:

<!-- @@Formula:

((issue.get("customfield_10503") != null ? Integer.parseInt(issue.get("customfield_10503").getValue()) ) +

((issue.get("customfield_10502") != null ? Integer.parseInt(issue.get("customfield_10502").getValue()) ) +

((issue.get("customfield_10505") != null ? Integer.parseInt(issue.get("customfield_10505").getValue() )


The code seems to be good, but it is not returning a value for any of the custom fields.

Would you be able to help me with this?



1 answer

1 accepted

Apologies, I meant to send this as an issue direct to Atlassian, not as a question here!! So it turns out that my code was correct, I could also use the following code:

<!-- @@Formula: 
(issue.get("customfield_10503") != null ? issue.get("customfield_10503") : 0) + 
(issue.get("customfield_10502") != null ? issue.get("customfield_10502") : 0 + 
(issue.get("customfield_10505") != null ? issue.get("customfield_10505") : 0) 

The problem was with one of my custom fields, I'm not sure what was wrong with it, but once I deleted it and created a new custom field and added that, it worked!!

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

281 views 38 9
Join discussion

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