You need to sign in to do that
Don't have an account?
Accessing Currency Conversion in Apex
Hi All,
I have recently been doing a requirement with google visualizations. I was successfully get the charts to work for me by plotting the values, but need some help with how the conversion rates would be visible.
The Scenario is as below:
We have a Corporate Currency - or organization default currency.
We have a user default currency on the user Record
We have a default currency for every record when Currency feature is enabled in our organization, which is the corporate currency. You may change this value while loading data in bulk or creating via UI.
Having said that when a user has data in the USD currency for instance and his personal currency is CHF (swiss franks), when veviews the records we would be able to see USD value as well as in brackets the converted CHF.
ex: 1234.45 USD (3673.CHF) ----> This is just an example to show how data is viewed on the detailed page.
But in my graph i am able to see it as 1234.45 and no converted values.
If someone has worked on this please let me know.
TIA.
Warm Regards,
Sushupsi
Hi All,
I have finally found a solution :)
When you need to retrieve the currency values/fields from a certain object and display them in the
User currency on a VF Page when you cannot use an input field is via a simple conversion function which is inbuilt in APEX.
See example below:
The convertCurrency function can act only on currency fields and returns values in the currently logged in user context.
This solved my issue. Hope this helps friends here :)
- Sushupsi.
All Answers
Hi All,
I have finally found a solution :)
When you need to retrieve the currency values/fields from a certain object and display them in the
User currency on a VF Page when you cannot use an input field is via a simple conversion function which is inbuilt in APEX.
See example below:
The convertCurrency function can act only on currency fields and returns values in the currently logged in user context.
This solved my issue. Hope this helps friends here :)
- Sushupsi.
Hi Sushupsi,
In my sceario i am haveing following condition.
1. Corporate Currency - or organization default currency is - USD
2. user default currency on the user Record - EUR
3. Currency Selected on record is - GBP.
So when i make a query for this record in apex code, i get amount in GBP.
If i use convertCurrency(Amount__c) i gets amount in EUR.
But i want to get amount in USD. how can i do this ?
@shiv shanks :
Use aggregate functions in your query they will return data in system currency.
SELECT sum(Asset__r.Price) Price,count(Name) Quantity, Status__c FROM Order_Line__c Group By Status__c
Above query's aggregate result Price column will return system currency data.