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
VishyRamVishyRam 

Roll Up Opportunity Amount at the account level for a Multi Currency ORG

Greetings Folks,

Need your. please sos.

I want to roll up the opportunity amout at the account level. The cavet is an account can have multiple opporutnity with difference currency. Namely an opportunity with Euro, 2nd one with CAD & 3rd with USD...So on and so forth. The issue I am facing is how to calculate all this on the fly and show in USD which is the account currency. With multi currency are teh exchange rates exposed for apex trigger to convert dynamically and update the account total? thankyou

vishy
Best Answer chosen by VishyRam
bob_buzzardbob_buzzard
Yes, you can access the conversion rates from a trigger - here's a snippet that extracts all exchange rates and stores them in a map keyed by iso code:

List<CurrencyType> cts = [SELECT ISOCode, ConversionRate
                          FROM CurrencyType];
                                          
Map<String, Double> ratesByIsoCode=new Map<String, Double>();
for (CurrencyType ct : cts)
{
    ratesByIsoCode.put(ct.ISOCode, ct.ConversionRate);
}


All Answers

bob_buzzardbob_buzzard
Yes, you can access the conversion rates from a trigger - here's a snippet that extracts all exchange rates and stores them in a map keyed by iso code:

List<CurrencyType> cts = [SELECT ISOCode, ConversionRate
                          FROM CurrencyType];
                                          
Map<String, Double> ratesByIsoCode=new Map<String, Double>();
for (CurrencyType ct : cts)
{
    ratesByIsoCode.put(ct.ISOCode, ct.ConversionRate);
}


This was selected as the best answer
VishyRamVishyRam
thank you Bob. appreciate your timely help. cheers