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
Community Members
Community Events
Community Groups

Maths with empty fields


Hoping someone else has come across this scenario with Automation for JIRA.

I'm trying to perform a simple addition of numbers using an Edit action:

{{issue.customfield_12143}} + {{issue.customfield_12144}}

This works, but only if both customfields have values (aren't empty). Otherwise, I get errors:

Could not convert the field value to a number. Please ensure the value is a number, math expression or smart-value that can be converted into a number.

Some Number Field: +

I also tried setting default values in the calculation, but didn't seem to help:

{{issue.customfield_12143|0}} + {{issue.customfield_12144|0}}

 Any thoughts? All fields are plain old number fields.



2 answers

1 vote

Hi Timothy,

I'm surprised that the default isn't working for you. What version of Automation for Jira are you using?

Simeon [Automation for Jira]

Our production is 4.2.3, but I just upgraded out test instance to 5.1.4 and same result.

I worked around it by basically checking if each field used in the calculation is empty and setting to 0. Just seems clunky.


Hi Timothy,

Were you wrapping this operation with the maths operator?

{{#=}}{{issue.customfield_12143|0}} + {{issue.customfield_12144|0}}{{/}}


Simeon [Automation for Jira]

Like Dave Sausville likes this

Whereabouts on is this 


explained? I understand but searched for NULL and lots of other things before finding this community question.

I'm assuming it will solve this error:

Could not convert the field value to a number. Please ensure the value is a number, math expression or smart-value that can be converted into a number.

Total: 1038.46 +

^ note no value at the end because my custom field value was NULL.

Hi Martin,

Yes, it should help you out with that issue!


Hi Martin,

For the record, my problem was never resolved. I just worked around it and moved on to other things! I was basing this off the Default Values functionality:

It's worked for text values in other situations, but I couldn't get it working with math operations. Not even wrapping it with the maths operator like Simeon suggested.

My workaround was breaking apart the operation into multiple automation steps, like:

  • If: matches {{FieldA}} equals Empty
    • Edit {{FieldA}}: 0
  • If: matches {{FieldB}} equals Empty
    • Edit {{FieldB}}: 0
  • Re-fetch Issue
  • Edit {{FieldC}}: {{FieldA}} + {{FieldB}}

And you could optionally wipe FieldA and FieldB if you didn't actually want the 0 value and have them show up on view screens, etc.


Like Martin Cleaver likes this

@Simeon Ross - I actually did a quick test again and seems like the same thing is working now. We're on version 5.1.12. Were there any changes made since 5.1.4?

I literally enabled the old broken automation job (+ disabled the workaround one I made) and it worked under exactly the same circumstance that previously got an error. Either way, I guess it's behaving as expected now!

Like Martin Cleaver likes this

Hi Timothy,

Not that I know of that would have affect this behaviour. It should have been included in 5.1.4, glad it is working for you though!



Like Martin Cleaver likes this

For anyone who comes across this and doesn't understand why there's isn't working, this feature is sensitive to spaces

{{variable| 0}}

behaves as expected

{{variable | 0}} 

always returns 0 (note the space between the variable and the vertical line)

I'm not sure if this is intended behavior, but it made for a frustrating morning 

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events