Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

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.

Formatting with built-in styles

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

Code Block
#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)

Format with Java Number format

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

...

Redirect
filename
locationhttps://docs.meta-inf.hu/email-this-issue-for-jira-server-data-center/documentation/outgoing-emails/email-templates/formatting-number-values

Thank you for visiting our old product documentation site. Note that we no longer store or update our documentation here.

Please navigate to our new documentation site and update your bookmarks accordingly. If you're looking for the former content of this page, click here.