Category: Multi Currency

How to Query Multi-Currency Fields in Salesforce

 In continuation to my earlier post about setting up multi-currency in Salesforce, this post will focus on how to query the multi-currency fields in SOQL and some cool formula features which you can use while dealing with multi-currency fields.SetupLet’s do the setup first.The corporate currency set in the Salesforce org is the Canadian Dollar i.e. CAD.Apart from the Canadian Dollar, other currencies supported are – U.S. Dollar (USD), Swiss Franc(CHF), and Indian Rupee(INR).Rates are also uploaded in the Salesforce org as shown below -Scenario:Opportunity record is having the currency field named “Opportunity Amount”. We need to fetch the Opportunity Amount based on the user’s currency mentioned in their user record.Solution:In order to fetch the Opportunity Amount based on the user’s currency, we can use Format() and convertCurrency() functions in SOQL.Format(): This function can be used in SOQL select statement to format date, time, and currency fields based on the given user locale.convertCurrency(): This function can also be used in SOQL select statement to convert the currency fields to the user’s currency.Using the above two functions here is the SOQL statement:SELECT Name, CurrencyIsoCode, Amount,FORMAT(convertCurrency(amount)) ConvertedinUserCurrency FROM Opportunity WHERE Name = ‘Burlington Textiles Weaving Plant Generator’Here is the result:As you can see, even though in this particular opportunity,  the amount is saved in USD, but with the help of above two functions, we are able to convert the currency to the...

Read More

Advanced Currency Management in Salesforce

Salesforce supports multi currency. You can enable the same by going to Company Information and then checking the box – “Activate Multiple Currencies”. You need to read the below article before enabling multi currency. https://help.salesforce.com/articleView?id=admin_enable_multicurrency_implications.htmOnce done, you can enable Dated Exchange Rate to define the exchange rate for any kind of periods like month, quarter, year etc. To do that you can go to Company profile -> Manage CurrenciesNow you can add the entries for dated exchange rates by clicking on the “Manage Dated Exchange Rates” button. And then click on “New Exchange Rates” button. Below images shows how to add dated exchange rates.This dated exchange rates are used in Opportunities, Opportunity products and Opportunity Reports.The object used to store this information is DatedConversionRate. You can run SOQL queries against this object to get the details -SELECT IsoCode,ConversionRate,NextStartDate,StartDate FROM DatedConversionRate ORDER BY NextStartDate ASCYou can use Rest Explorer also to add/delete new DatedConversionRate like below -Important Objects/Fields:CurrencyType: This object stores the list of currencies used in the org when multi currency is enabled. If single currency is used in the org, then this object is not available.DatedConversionRate: This object stores the dated exchange rates.CurrencyIsoCode: This additional field is present in object which has current field and the org has multi-currency...

Read More
Loading