It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Code for Calculated Number Field

Hi,

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?

Thanks

Elaine

1 answer

1 accepted

0 votes
Answer 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
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

331 views 5 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you