+ Start a Discussion

Formatting Currency fields in multi-currency Org


I am using the OpportunityLineItem.TotalPrice field in one of my VisualForce pages with the Standard 'Opportunity' controller.  We are preparing a sort of quote document with the line items and amounts from an Opportunity.  I am using the 'outputField' tag to show this field.  Simplified version of the code below:

<apex:dataTable value="{!opportunity.OpportunityLineItems}" var="Item" width="675" rules="all" cellPadding="6" styleClass="data" columnClasses="info_bottom_1, info_bottom_2, info_bottom_3, info_bottom_4">
                 <apex:outputField value="{!Item.TotalPrice}"/>

Since our organization has multi-currency turned on, the values coming from the 'TotalPrice' field have the ISO code as well as the value, and do not have a Currency Symbol.  For example, this is shown as:

USD 47,250.00

However, we would like to show this value as:


Is there some way to have Salesforce return the value in this format?   Can this be done across currencies ?

Or, does someone have a good suggestion for doing a sort of  'replace' function so that I can replace the ISO code with the currency symbol for our currencies??

Many thanks for any ideas.




anyone have any ideas here?  or, did i miss something obvious?

Kirk F.ax361Kirk F.ax361
    public string getCurrency() {
        string s = '';
        string ISO = getOpportunity().CurrencyISOCode;
        s = ('USD' == ISO ? '$' : 
            ('CAD' == ISO ? '$' : 
            ('EUR' == ISO ? '€' : 
            ('GBP' == ISO ? '£' : 
            ('CNY' == ISO ? '元' : 
            ('JPY' == ISO ? '¥' : 
            ('KRW' == ISO ? 'etc.' : ''
        return ('' != s ? s : getOpportunity().CurrencyISOCode);

Try starting with that, and work from there...

Message Edited by Kirk F on 10-31-2008 12:39 PM

Hi - I am having issues with this as well. Have you encountered the issue where if a user's default currency is different then the record's currency it displays the conversion on the VF page? for example:

GBP 694.60 (USD 1,000.22)


Any idea how to get it to not display the conversion

Kirk F.ax361Kirk F.ax361

First things first: I think it's actually kinda nice to see the transactions in a currency I don't understand well (like Japanese Yen) with a "courtesy conversion" into my own native currency (for me, US$).  I can more easily catch obvious errors when I see the error in a currency I'm familiar with.  Remind your users about this benefit, and ask them how hiding that courtesy conversion saves them time, money, or effort.  Many times, people "just don't like it" but can't explain why.  If they can't explain why, I can't fix it.  Otherwise, I'd be wasting everyone's money changing the SFDC background colors. ;-)


But let's say, after that discussion with you, they actually do have a good reason why they don't want to see the courtesy conversion.  Post those reasons here, and I'll give you two techniques to hide the conversion.

Arnab ThokderArnab Thokder

@ Kirk

Reason to hide default currency

We have a custom exchange rate field which is entered by user depending upon customer demand. Now suppose one formula currency field is taking into consideration the custom exchange rate instead of standard defined rates. In that case the converted amount in the brackets would be different and equally confusing. Hope this is a good enough reason to hide the default currnecy. Could you please let me know if you have any solution on this. Any help would be appreciated. BTW, the page in our case is a standard one, not a VF page.