I need a little help . I am almost there ... but need a little hand-holding. Agenda is to ALWAYS display the value converted in EUR - does not matter what the record currency is.

I am using this code below:

trigger convertToEuro on CustomObject(before update) { 
    List<CurrencyType> currencyTypeList = [select id,IsoCode,ConversionRate from CurrencyType where isActive = true] ;

    Map<String , Decimal> isoWithRateMap = new Map<String, Decimal>();

    for(CurrencyType c : currencyTypeList) {

        isoWithRateMap.put(c.IsoCode , c.ConversionRate) ;


    for(CustomObject ce: trigger.new){

        if(ce.CurrencyIsoCode != 'EUR' && isoWithRateMap.containsKey(ce.CurrencyIsoCode)){

            ce.Amount_Converted__c = ce.ffps_iv__Amount__c/ isoWithRateMap.get(ce.CurrencyIsoCode);



It is doing everything fine except the fact that the Amount_Converted__c field's values are displayed as USD (& EUR) but EUR seems like display only value - the USD is what the Amount_Converted__c field is holding. I want to use Amount_Converted__c converted in EUR in my workflow but instead I am getting the USD value - how could I just get the EUR value? I don't really need the Record Currency type - I need my EUR currency to be used in my workflows/approvals.

enter image description here

What could I be doing wrong?

1 Answer 1


When you are doing things like this (manual conversion of currency fields), the target of the conversion (Amount_Converted__c) needs to be of type Number, not type Currency.

When it is a currency type, SFDC OOTB rules for how currencies are displayed are governed by the record's currency and the user's currency.

When I've done what you are doing in the past, I've named my custom field Amount_EUR__c to be explicit about what the field's content contains.

Of course, another option you might consider is to make your org's currency = EUR - this way, all reports and dashboards will roll up currencies to EUR automatically.

  • I did the number field and then it would not even convert at all - not sure why. It would show 472,768.00 - if after converting the field type to number it would show 440,891.54 I would be okay. But it does not, not sure why though? Thanks for the suggestions though.
    – Steve
    Dec 18, 2017 at 22:46
  • @steve - I find this hard to believe; internally, numbers and currency types are both expressed as Decimal
    – cropredy
    Dec 18, 2017 at 23:13
  • @Cropedy - I was wrong - and you were right. It does convert and thanks for the help. The above code does not need any change - it is perfect the way it is.
    – Steve
    Dec 19, 2017 at 15:16
  • @steve - as a courtesy to the community, if the answer addressed the issue, please mark as answered.
    – cropredy
    Dec 19, 2017 at 16:09
  • @Cropedy: Can you help me in writing a test class for this, please?
    – Steve
    Jan 25, 2018 at 21:25

You must log in to answer this question.

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