How to Query Currency Fields in Multi-currency Organization in Salesforce?

How to Query Currency Fields in Multi-currency Organization in Salesforce?

Use convertCurrency() in the SELECT statement of a SOQL query to convert currency fields to the user’s currency. This action requires that the org has multiple currencies enabled.

You can’t use the convertCurrency() function in a WHERE clause. If you do, an error is returned.

Sample Queries:

SELECT Id, convertCurrency(AnnualRevenue) FROM Account

The above query will return AnnualRevenue in the user’s currency.

SELECT Id, Name FROM Opportunity WHERE Amount > USD5000

In this example, opportunity records are returned if the record’s currency Amount value is greater than the equivalent of USD5000.

Check the below link for more details

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_querying_currency_fields.htm

Cheers!!!

Leave a Reply