Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Values of Number custom fields or number constants may be formatted in email templates in various ways.

The key to number formatting is the $!number variable which is an instance of the NumberTool Jira API class.

NumberTool provides buit-in styling for formatting numbers but also provides access to Java NumberFormat API which provides ultimate formatting capabilities.

Below is an example of formatting the value of a number field called "My Number Field" in various styles.

#set ($numberValue = $!issue.getCustomFieldValue("My Number field"))

Integer: $!number.format("integer",$!numberValue)

Number: $!number.format("number",$!numberValue)

Currency: $!number.format("currency",$!numberValue)

Percent: $!number.format("percent",$!numberValue)

Default: $!number.format("default",$!numberValue)

Below is an example of using Java's NumberFormat to render the number value in Japan's currency:

#set ($numberValue = $!issue.getCustomFieldValue("My Number field"))
#set($numberFormat = $!number.getNumberFormat("currency", $!templateSupport.getLocale("jp_JP")))

Currency in Japan: $!numberFormat.format($numberValue)


  • No labels