Session and reference currency

The system uses two kinds of currency, session and reference.

The session currency is defined for the user by the user’s locale or single-currency mode. The reference currency is determined by the system locale. The reference currency is a standard used across the entire instance. Each time a value is entered in a currency or price field, the system stores three pieces of information:
  • The value as entered, in the user's locale.
  • The currency code, in the user's locale.
  • The value converted to the reference currency using the current exchange rate.
Note: In multiple-currency mode, the currency code saved in currency field may not be the same as the session currency code. For example, the session currency could be the Euro and the number entered could be the Japanese Yen.

Session currency

When users view a currency value, they can see the value as entered or in the session-currency format. The format contains:
  • The currency symbol
  • The value converted to the session currency and shown in a localized number format.
The user’s locale determines the session currency format.
The number format can differ in features such as the decimal separator based on the locale; for example, the US formatting is 1,234,567.89 while German formatting is 1.234.567,89. The session currency is determined by the following, in order of consideration:
  • Single-currency mode setup using glide.i18n.single_currency and glide.i18n.single_currency.code.
  • The default currency for the user’s locale.

Reference currency

In order to perform calculations on heterogeneous currency values, the platform stores currency values converted to a system currency, referred to as the reference currency. Every currency field in the system contains a reference currency value. The reference currency is determined by the following, in order of consideration:
  • The system locale set using the property glide.system.locale
  • The Java default locale, typically en.US

The filtering and aggregation features use the reference currency value to perform calculations on default currency fields. This can yield inaccurate results because of conversion rate changes.

Issues with currency fields

Users are often confused by the results of filtering, sorting, and displaying currency fields because the system works with at least two currencies for each value: the session currency and the reference currency.

Note: Aggregations and filtering of currency fields use the reference currency, and the user sees the session currency. Because of changing conversion rates, the filtered reference currency values might not result in the same order as the session currency values would suggest. The same issue happens with aggregations.
The user might see the following issues:
  • Lists filtered on currency fields might not be in the expected order because the reference currency values are used for filtering but session currency values are displayed.
  • Aggregation of currency fields might not produce the expected results because reference currency values are aggregated and then converted to the session currency.
  • Currency values might not be formatted as expected because currency values are formatted based on the user's locale and not on the currency code

The confusion is caused by the difference between session and reference currencies, changing conversion rates, and different session currencies used by different users.