Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,889
Community Members
 
Community Events
165
Community Groups

Sum of Multiple Custom Fields Displayed in Total Field Only if Data is Entered

Hi Folks, 

This is for a project being used by our Tax department.  I have 14 custom numeric fields for different tax types that I need to total into a "Total Amount Due" numeric field.  

I've created an automation to do this which works if all fields have a value entered.  I'm using the smart value below to update the "Total Amount Due".  I can set this to trigger on issue update or on update of any of the specified fields, or even from manual trigger and it works fine if each of those fields have a value entered:  

{{#=}}{{issue.Income Tax}}+{{issue.Franchise Tax}}+{{issue.S Corp Tax}}+{{issue.Business Tax}}+{{issue.Tax on Actual Distributions}}+{{issue.Built-In GainsTax}}+{{issue.Minimum Tax}}+{{issue.Pass-Through Entity Tax}}+{{issue.Composite Income Tax}}+{{issue.Nonresident Withholding Tax}}+{{issue.Annual Fee}}+{{issue.Other Amount Due}}+{{issue.Interest}}{{/}}

If any of the 14 fields mentioned do not have a value then the automation errors out.  I'm curious if there's a way to accomplish this with treating Blank/Null values as a 0 or a "simple" way to ignore blank fields in the automation. 

I can set a default value for these fields of 0 which corrects this but these are not all needed on every issue, so I currently have these fields hidden on the issue screen if they contain no value, in order to keep the screen from being too cluttered with irrelevant fields.  I would like to preserve that if possible.  

I also tested using "Else/If" blocks to specify if certain fields are empty to ignore them from the total.  This works great for getting a total of 1 - 3 fields, but for 14 that's a lot of Else/If combinations.  

Thanks so much for any assistance/suggestions.  

2 answers

0 votes
John M Funk Community Leader Jun 02, 2022

Hi Jonathan,

Try this syntax for each field:

{{issue.Income Tax| 0}}

0 votes
Clark Everson Community Leader May 31, 2022

Hi @Jonathan Hendrix 

I believe with automation for Jira it isn't able to handle something as advanced as excluding values. The scripting in automation for Jira is pretty basic. If using scriptrunner you can write a script in groovy that accounts for this.

Best,

Clark

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,913 views 37 49
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