Hello,
I have a number field that I need to be copied to a text field. I use Automation fro Jira for this.
Jira always adds a .0 when I use {{issue.customfield_0000}}.
I have tried
{{issue.customfield_00000.remove((.0))}}
{{issue.customfield_00000.replaceAll("([0-9])"."")}}
And none of them work,
{{issue.customfield_00000.remove((.0))}} works if it is from text field to text field.
Any idea of the correct syntax?
Thanks
If the fields are numeric, then the problem is not the extract and copy, it's the display format of the field. There's nothing you can do about that in the automation, you'll need to look at the field display settings.
Hello Nic,
Only the first field is numeric, the second one is a text field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That would explain it. You're taking a numeric value which is a number and has nothing to say about how it is displayed and converting it to a string and the conversion code is assuming that because a number could be fractional, it's putting a .x on the end to show that.
issue.customfield_00000.replaceAll("([0-9])"."")
doesn't do anything because the source custom field does not have a .0 in it - it's a number, not a string. You need to do the replacement *after* converting to a string.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lara Lopez
With automation for Jira, you could use a math expression to round() or floor() the value to the nearest integer, or you could use the format command to only include the integer part:
Best regards,
Bill
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.
Interesting... I rechecked and all of those functions work as documented for me. Please note that for format() you need to provide a format string, such as .format("#")
And, I noted you are using Server version, so let's try this syntax:
{{#=}}FLOOR({{issue.customfield_18986}}){{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've found a similar problem.
In my case, copying a numeric field into a text field, adds extra position by the right, showing E11 value (which was eleven zeros)
Using Floor conversion caused the same extra position by the right.
I share the syntax has fixed the problem and has worked in my case:
{{issue.customfield_18986.format("###") }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Simply run an automation and edit the field with {{issue.fieldname.replace(".0","")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.