Remove unwanted commas from a JIRA Number field |
JIRA has this annoying habit of adding commas to Number custom fields:
Sometimes a comma is appropriate, but sometimes it isn't. There is a feature request to make commas optional (), but the limitation is baked deep into the custom field system, and since the request has been open since 2005, I'm not holding my breath.
A workaround is to use a Text field (single line) instead, but then:
Transaction ID" = 10002
)"Transaction ID" IN (10002, 10003)
):There are workarounds for the problems with this workaround: input validation can be achieved with a post-function validator. The last two problems can be fixed by install a plugin – Stattable Searchers or Natural Searchers.
The final solution (for non-Cloud) is to tweak JIRA's Number field velocity template. Specifically:
atlassian-jira/WEB-INF/classes/templates/plugins/fields/view/view-number.vm
Replace the line:
$!numberTool.format($value) |
with lines:
#if($customField.id == 'customfield_16300') $value.longValue() #else $!numberTool.format($value) #end |
This is what Atlassian's KB article suggests, except that here we do it for one field only. Also, the KB article's suggestion to make velocity templates editable by editing velocity.properties
no longer works.
Note that the hack will need to be ported forward every time you upgrade JIRA.