how to automatically calculate a sum based on 2 custom fields ?


I created a field "Total" and in the description, I wrote the following formula in the description :

This field is a calculation of IT Cost Estimation (MD)(customfield_10311) + OPS Cost Estimation (MD) (customfield_10176) <!-- @@Formula: if ((issue.get("customfield_10311") != null) && (issue.get("customfield_10176") != null)){

var IT Cost Estimation (MD)= 0; var OPS Cost Estimation (MD)= 0;

return (IT Cost Estimation (MD)* OPS Cost Estimation (MD)); } -->

both custom field are numerical fields.

but it does not work. Any ideas?

Thanks a lot for any help

2 answers

Do you want to create a sum or multiply them? I think the following code should work:
<!-- @@Formula: return ((issue.get("customfield_10311") != null ? issue.get("customfield_10311") : 0) + (issue.get("customfield_10176") != null ? issue.get("customfield_10176") : 0))-->

thanks a lot for your answer. I'll try it as soon as I can as I have a bug with my custom fields. I can't see the entire list anymore...

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

225 views 1 18
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