Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Hendrix_ Jonathan May 31, 2022

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 Funk
Community Champion
June 2, 2022

Hi Jonathan,

Try this syntax for each field:

{{issue.Income Tax| 0}}

0 votes
Clark Everson
Community Champion
May 31, 2022

Hi @Hendrix_ Jonathan 

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
Product Admin
TAGS
AUG Leaders

Atlassian Community Events