function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bob17bob17 

How to get the Currency Symbol

Anyone know how, from Apex, to get the currency symbol that is used when formatting currency fields in a single currency org?

 

If I had to I might be able to build my own mapping based on the Currency Locale setting in the Company Information page but I can't find what field in the Organization record gets updated when this value is set.

 

UserInfo.getDefaultCurrency() does not work - it retus nothing in a single currency org.

 

The format function on an sObject currency field (MyOppty.Amount.format()) does not include a currency symbol.

 

I need the value in Apex so the outputField tag in VF is not helpful (and can't be used in a multi-currency org with ACM enabled).

 

Last resort is to have a  Custom Setting and have customers enter their currency symbol but that creeates extra work for the customer and they think we are stupid or lazy.

 

Thanks for any assistance

kritinkritin

See the below debug command:

system.debug('================' + userInfo.getDefaultCurrency());
system.debug('================' + userInfo.isMultiCurrencyOrganization());

And see the query:

Select c.IsoCode, c.IsCorporate, c.IsActive, c.Id From CurrencyType c

 

ISOCode will tell us the currency type weather it is USD, MXN or  CAD or INR .

 

this code can be used as Symbol.

 

 

bob17bob17

kritin,

 

Thanks for the response but that would only work in a multiple currency org.  The CurrencyType object does not exist in organizations that have not enabled multiple currency support.  My challenge is how to determine what the default currency is in a single currency org.

 

Thanks,

 

Bob

Ritika BhargavaRitika Bhargava

Hey Bob,

 

Facing same issue and would really appreciate it any help related to this topic.

 

Thanks,

Ritika