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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
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