Remove Commas for Values held in Number Field Custom Field Type

Still need help?

The Atlassian Community is here for you.

Ask the community

The information on this page relates to customizations in JIRA Applications. Consequently, Atlassian Support cannot guarantee the provision of any support for the steps described on this page as customizations are not covered under Atlassian Support Offerings. Please be aware that this material is provided for your information only and that you use it at your own risk.

Also, please be aware that customizations done by directly modifying files are not included in the upgrade process. These modifications will need to be reapplied manually on the upgraded instance.

JIRA adds commas to numeric value stored in Number field, like 1,234. For further reference see  JRA-7582 - Getting issue details... STATUS .

If you don't want commas to be added, edit /WEB-INF/classes/templates/plugins/fields/view/view-number.vm. Replace the following line:


$!numberTool.format($value)

with:

$value.longValue()


Make sure to back up the Velocity file before changing it.

Disable commas for a single customfield

It's possible that you would like to disable the commas for a single custom field instead of multiple custom fields in this case, we can add the customField.id value to filter for this custom field specifically.

This will require you to identify the customfield ID by inspecting the URL while editing the custom field. For example, if customfield "Phone Number" has the ID 10900 the value would look like:

#if ($customField.id == 'customfield_10900' && $value)
$value.longValue()
#elseif ($value)
$!numberTool.format($value)

It's possible add multiple custom fields by adding multiple elseif statements.


Deploying Velocity Templates without a Restart

In a development instance, you can configure JIRA to pick up velocity file changes without a restart.

From <jira-install>/atlassian-jira/WEB-INF/classes/velocity.properties:

  1. Change class.resource.loader.cache from true to false
  2. Uncomment (remove the # sign from)

    #velocimacro.library.autoreload=true
    

Last modified on Sep 3, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.