I have a currency field on my Opportunity object, in a multicurrency enabled org, and I have a numerical field in a child object of it, which holds an "always" GBP financial value.

I then have a trigger which at a certain moment in time needs to copy the numerical field into the Opportunity..

When I do this, the raw numerical value is dumped into the Opportunity, and then displayed as is against the Opportunity Currency ISO code.

eg. The child has a numerical value of 600.50 - which is known asolutely to be GBP, but when this is copied into an Opportunity whose currency setting is USD, it shows something like

600.50 USD (390.53 GBP)

(ths GBP bit is because of my locale settings, users in other currencies will see even more random conversions)

So my question is How do I indicate when I set a value into a multicurrency field that it is in fact in GBP - or - how do I determine what Curreny it is expecting, and convert my GBP value into it first? (even though in the second scenario, the display is just going to covert it right back in the bit in the brackets!)

1 Answer 1


If an org has multicurrency enabled, the standard field CurrencyISOCode is available on every object. It will default to a user's default currency. You can set it to any of the enabled currencies for your org. Enabled currencies are found in Setup > Company Profile > Manage Currencies.

So if you have an always-GBP value, you need to check Opportunity.CurrencyISOCode and if it isn't GBP, find the exchange rate for your currency in the CurrencyType object and read its ConversionRate.

For example:

SELECT Id, ConversionRate 
FROM CurrencyType 
WHERE IsoCode = :Opportunity.CurrencyISOCode

If your org has Advanced Currency Management enabled, exchange rates are stored in the DatedConversionRate object, and have a validity date range. For example:

SELECT Id, ConversionRate
FROM DatedConversionRate
WHERE IsoCode = :Opportunity.CurrencyISOCode
AND   StartDate <= :Opportunity.CloseDate
AND   NextStartDate > :Opportunity.CloseDate

You can use any date you want to get the dated exchange rate, but as @crop1645 pointed out, the default that Salesforce uses for Opportunity Amount is CloseDate, so you would be consistent if you use CloseDate as well.

  • you might want to also add bits about if user is using Advanced Currency Mgt which has dated exchange rates - in these cases, the currency conversion logic depends on some date and uses SObject DatedConversionRate
    – cropredy
    Commented May 8, 2015 at 16:25
  • Ok. Thank you guys. We are using the dated exchange stuff, so I will bear that in mind. Will feed back if I have success with this advice (probs tomorrow now) Commented May 8, 2015 at 18:00
  • @crop1645 good idea. done.
    – Dominic
    Commented May 11, 2015 at 7:41
  • Dominic -- if using Opportunity, DCR by default in OOB SFDC will use closeDate, not createdDate
    – cropredy
    Commented May 11, 2015 at 21:18
  • I thought it did too, but then when I typed it, it didn't feel right. I'll fix the answer.
    – Dominic
    Commented May 11, 2015 at 21:20

You must log in to answer this question.

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