14

First of all, before telling me that this is a duplicate of the previously-asked question "Display currency symbol", READ THE WHOLE QUESTION.

Summary: I am trying to replicate the functionality of the Salesforce.com "Currency" field type in a Single-Currency org, but cannot because I cannot find the ISO Locale code of the Organization Currency Locale (which, for single-currency orgs, defines BOTH the ISO Locale that will be used for formatting currency number values AND the ISO Currency code that will be used to prepend/append a corresponding currency symbol.

For Single-Currency orgs, the Organization-wide "Currency Locale" field, which MUST, I believe, behind the scenes consist of BOTH an ISO Currency Code (e.g. USD, EUR) AND an ISO Locale Key (e.g. en_GB, fr_FR). The reason that it must consist of BOTH the ISO Country Code and Locale Key is that this information is necessary in order for Salesforce.com to render Currency fields, which take a Double value, apply a locale-specific Number Format to it, and then prepend/append the ISO Currency Code's associated symbol (e.g. '$').

The Organization "Currency Locale" field can be edited by going to Setup > Company Profile:

Company Profile - Currency Locale field

However, as far as I can tell, this field is NOT available on either the Organization object, User object, or through any Apex system class (e.g. UserInfo). UserInfo.getDefaultCurrency() returns, helpfully, the ISO Currency Code part of the Currency Locale field. However, there is no way to get at the locale half of the field!

This is a problem because there is a one-to-many mapping between ISO Currency Codes and Currency Locales. For instance, according to [Salesforce.com's list of supported locales] (http://help.salesforce.com/help/doc/en/admin_supported_locales.htm), the 'EUR' ISO Currency Code is used by 37 different supported user locale codes, e.g. it_IT, fr_FR. But not all of these locale codes have the same number format. For instance, examine the following Number Formats for ISO User Locales that use the 'EUR' ISO Currency Code:

  • it_IT: 1.234,56
  • fr_FR: 1 234,56
  • en_IE: 1,234.56

So what's the big deal? Well, you can't rely on an Organization's Currency Locale being the same as a User's configured Locale, so there's no (supported) way, in Single Currency orgs, to determine the Currency Locale to use to render currencies in that locale's number format UNLESS you use the Salesforce.com Standard UI or apex:inputField.

Here's an example of a Contact detail page with 2 fields, one a Number, and one a Currency, with the number format of each being different on account of the difference between Organization Currency Locale and User Locale:

sample Contact detail page

From a totally custom Visualforce UI, e.g. NOT using apex:inputField or the standard UI, I can properly format the Number field "Total Mass (Grams)" because I can access the User's Locale through UserInfo.getLocale(), which here is set to 'en_US'. However, I cannot replicate the "Net Worth" field, a Currency field, because the Organization's Currency Locale information (which is set to 'fr_FR'), is not available from Apex/SOQL.

If anyone can find a way to retrieve this information from Apex / SOQL, I would be very thankful!

EDIT For confirmation that this info is not accessible from Apex/SOQL/Web-Services-API, I discovered that there is an Idea posted about this (with woefully few votes--- VOTE IT UP!):

Idea: 'Default Time Zone' and 'Currency Locale' available on the Organization Object

3
  • In your example, what's so bad about formatting the Net Worth field as a combination of the User's Locale (for the numeric formatting) and getDefaultCurrency (for the currency symbol)? Can't Net Worth be formatted as 23,472,934.44€?
    – tomlogic
    Dec 20, 2012 at 23:12
  • @tomlogic There's nothing necessarily "bad" about it --- that's what I'm going to have to do due to the lack of this information. What is "bad" is that I cannot replicate the functionality that Salesforce.com natively provides, where the Currency number format may be completely different than all other Number formats on account of Currency Locale being set to something other than User locale.
    – zachelrath
    Dec 21, 2012 at 11:37
  • Can I suggest you post your edit as the answer. Currently this question is hanging out in the "unanswered" queue. Seems to me the answer (for now), is "vote up this idea on idea exchange".
    – pchittum
    Jan 24, 2013 at 15:42

2 Answers 2

3

It appears that this info is not accessible from Apex/SOQL/Web-Services API - here is a link to an Idea posted about this (with woefully few votes---vote it up!

Idea: 'Default Time Zone' and 'Currency Locale' available on the Organization Object

1
  • Is this still the case as of 2021? May 13, 2021 at 10:42
0

As of 2020, it is possible. The endpoint is detailed in the top reply on the thread mentioned in the other answer as ConnectApi.OrganizationSettings sample=ConnectApi.Organization.getSettings();. In REST API terms, that would be a GET request to /connect/organization

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .