Pages

22 November 2012

Access Currency Conversion in Apex

In Organizations with multi-currency enabled, data would be entered in corporate currency. When the users logs in, it is always advantageous to have the data displayed in the users personal currency.

This happens by default when we view a standard detailed page of any record, or on a report, but when we access the data via Visualforce pages, we need to have the currency value not in base currency but the logged in user's currency.

How do we achieve this via Apex, keeping the conversion for current users ?

Apex provides very easy solution to this.

Select Account__c, Type__c, Year__c, UOM__c,convertCurrency(Jan__c),
NOTE: The convertCurrency function can act only on currency fields and returns values in the currently logged in user context.

Hope this helps.

No comments:

Post a Comment