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

Accepted Answer
0 votes

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
Community showcase
Posted Friday in Europe

Venue Needed! 23rd October

Hey Everyone! Unfortunately, the venue that was hosting us on the 23rd has pulled out so we're looking for a new venue.    If anyone would have a room free that we could use on the ev...

36 views 1 0
View post

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