You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi,
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.
TM
Hi Timothy,
I'm surprised that the default isn't working for you. What version of Automation for Jira are you using?
Cheers,
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Timothy,
Were you wrapping this operation with the maths operator?
{{#=}}{{issue.customfield_12143|0}} + {{issue.customfield_12144|0}}{{/}}
Cheers,
Simeon [Automation for Jira]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Whereabouts on https://docs.automationforjira.com/working-with-issue-data/math-functions.html#where-to-use is this
field|0
explained? I understand but searched for NULL and lots of other things before finding this community question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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: https://docs.automationforjira.com/working-with-issue-data/smart-values.html#default-values
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:
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.
TM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
Cheers,
Simeon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The manager’s daily activities include a list of challenges to reach high levels of efficiency for their teams. Part of these challenges is related to how to deal with the worklog systems sin...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.