+ Start a Discussion

AggregateResult & Currency support

Hello one and all, and Merry Christmas (or Happy Holidays).


I have an issue with some code I have written that uses AggregateResult (SUM) function, the code is totalling the sum back to the org default currency (which is what is stated in the help documentation).  My issue is when placing the amount totalled back into a currency field on a record with a different currency.


So say (hypothetically - for arguments sake lets say that it is £1=$2 conversion rate):
Acct A = US$10 (£5)
Acct B = US$6 (£3)
The total should obviously be = US$16 (£8).  The total it is showing is US$ 8 - so it converts the figures into GBP values,  totals the values and then puts this amount into the currency field - though the field is showing the wrong currency code as the account currency is USD.
If there is an account that is in GBP - there is no issue though - so yay :-)
Is there a way to take the figure that the aggregateresult figure and then convert it back to the account currency?
Best Answer chosen by Admin (Salesforce Developers) 

For anyone else with similar issue I think I found a possible answer based on the following link:



Also found the CurrencyType methods *DOH*