2

I need to get currency symbol in visual force email template. I want it to be the currency the user is using. I check the docs here:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_outputText.htm

But don't see anything that will give to me.

Any tips?

1
  • Do you need it as a field formula? Commented Dec 20, 2012 at 12:26

2 Answers 2

4

I'm infering from your question that User is the recipient type on your email template. So, how about something utilizing Custom Labels and the ability to access them dynamically, e.g.:

<messaging:emailTemplate subject="Test" recipientType="User" relatedToType="Account">

<messaging:htmlEmailBody >

   <apex:variable var="isoCode" value="Currency{!recipient.CurrencyISOCode}"/>        
   <apex:variable var="currencySymbol" value="{!$Label[isoCode]}"/>

   Your balance is {!currencySymbol}200.00

</messaging:htmlEmailBody>

</messaging:emailTemplate>

Then you can create a Custom Label CurrencyUSD, CurrencyGBP etc. etc.

8
  • I don't know enough about it, so i've added it as a comment but I wondered if Translation Workbench might also provide some options too? Commented Dec 20, 2012 at 13:32
  • I think he needs an image, not a text Commented Dec 20, 2012 at 13:46
  • @mast0r - yeah, i noticed that in your answer...I couldn't see a reference to an image, but i did go out on an Xmas party last night so my eyesight is not at its best :) Commented Dec 20, 2012 at 13:52
  • 1
    For me the party is just tonight :) Commented Dec 20, 2012 at 13:54
  • @Phil Hawton first line is <messaging:emailTemplate subject="Daily Digest" recipientType="User" relatedToType="My_Custom_Object__c"> so yes. Howevere your idea gives me: Error: Invalid field CurrencyISOCode for SObject User
    – dublintech
    Commented Dec 20, 2012 at 13:57
1

For the visualforce page i would take this one:

<apex:image value="{!CASE(YourObject.CurrencyIsoCode,'EUR','/img/euro.gif',
                                                     'GBP','/img/gbpfund.gif',
                                                           '/img/default.gif')}"/>

Like Mohith say's, here is an example with static resource :)

<apex:image value="{!CASE(YourObject.CurrencyIsoCode,'EUR',URLFOR($Resource.MyRes,'img/eur.gif'),
                                                     'GBP',URLFOR($Resource.MyRes,'img/gbpfund.gif'),
                                                           URLFOR($Resource.MyRes,'img/default.gif'))}"/>

And for the Image field this:

IMAGE(CASE({!YourObject.CurrencyIsoCode}, 'EUR', '/img/euro.gif', 
                                          'GBP', '/img/gbpfund.gif',
                                                 '/img/default.gif'), 'image_label')
1
  • 1
    You may like to show how you can use static resources in your answer :).These images can change in sfdc server without any notice :) Commented Dec 20, 2012 at 13:11

You must log in to answer this question.

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