3D eBook cover with text A Guide to Salesforce Marketing Tools
Free ResourceDownload now

Firstly, many AppExchange options can automate the process and with Salesforce’s robust security, these are a fine choice. On the other hand, it’s possible to automate currency conversion in Salesforce with a simple out-of-the-box feature called ‘Schedule Triggered Flow’.

This removes the need for manual entry and frees up time for your Admin users to focus their attention on other parts of the system. 

Automating Salesforce currency conversion

Before you proceed, it is recommended that you build this in a Sandbox environment to avoid the risk of corrupting anything in your existing Sales Cloud account, should you encounter issues.

In addition, there are a variety of things an Admin will need to know and think about before enabling ‘Multiple Currency’ and ‘Advance Currency Management’. It’s best you skill up on the below topics prior to starting:

By the end of this blog, you will be able to:

  • Create an outbound request using Names Credentials

  • Callout to an external API using a Scheduled Trigger Flow.

  • Bypass the character limit of Flow Formulas (3900)

  • Initiate an outbound HTTP Get Request, eliminating the need for code

  • Update DatedConversionRates for Multiple Currencies

  • Validate and test the data flow works as it should

  • Plus more…

To make it a bit easier to follow along, we’ll use an example use case:

Wilson is the new Sales Cloud Administrator at Campervan Excursions and has been given the task of automating the DatedConversionRates automatically. He has been asked to make sure they are updated at 00:01 am every day to ensure the sales team has the most up-to-date rates.

Step 1: Activate Multiple Currencies

The first thing Wilson does is activate Multiple Currency from the Company Information Settings:

  1. Click ‘Setup’

  2. In the Quick Find Box, Enter ‘Company Information’

  3. Click ‘Edit’

  4. Scroll down to ‘Currency Setting

  5. Click ‘Activate Multiple Currencies’

  6. Click ‘Save’

Screenshot of Salesforce Activate Multiple Currencies setting

Step 2: Add Currencies to Active Currencies

Next, Wilson needs to add the currencies his organisation uses to the list of ‘Active Currencies’ in Salesforce. Wilson will add EUR, AUD and USD and make sure his Corporate Currency is set to GBP.

  1. Click ‘Setup’ (if not already there)

  2. In the Quick Find Box, enter ‘Manage Currencies’

  3. Click ‘New’

  4. Add the currencies your organisation uses and the current exchange rate

  5. Repeat for all currencies

Step 3: Enable Advanced Multiple Currencies

Now that he has activated Multiple Currencies, Wilson activates Advanced Multiple Currencies. The reason why will become apparent later on, when updating Dated Conversion Rates in the Scheduled Flow.

  1. Click the ‘Enable’ button, read and accept the additional Info screen

  2. Click ‘Manage Dated Exchange Rates’ - here you can update the exchange rate manually but there is no need as we’ll be doing this via a Flow.

Screenshot of Salesforce advanced currency management

From this screen, you can also view which currency is set as your Corporate Currency.

Screenshot of Salesforce advanced currency management enable
Screenshot of Salesforce dated exchange rate
Screenshot of Salesforce advanced currency management country

Step 4: Register for a free Exchange Rate API account

There are a number of free Exchange API services available.  Today Wilson will be using ‘Exchange Currency API’. Other options available are:

You can also view this article by APILayer for other free services.

  1. From the dashboard of currencyapi.com, copy your API key.

It should look something like this:

https://api.currencyapi.com/v3/latest?apikey=YOUR_API_KEY_GOES_HERE

Screenshot of Salesforce API key

Step 5: Create a Named Credential

  1. Click ‘Setup’

  2. In the Quick Find Box, Enter ‘Named Credential’

  3. Click the down arrow next to ‘New’

  4. Select ‘New Legacy’

  5. Name the callout ‘currencyapi’

  6. In the URL box enter the first part of your API URL: https://api.currencyapi.com

7. Leave the rest as is

8. Click ‘Save’

Free Guide to Salesforce Tools

With the eBook ‘A Guide to Salesforce Marketing Tools’ in your arsenal, you’ll have a go-to, comprehensive, expert guide to understanding and selecting your perfect Salesforce marketing platform(s).

  • The Salesforce ecosystem
  • Understanding Salesforce tools
  • Choosing your Salesforce tools
  • Implementation tips
  • Build your business case
  • Free quiz
Download A Guide to Salesforce Marketing Tools
3D eBook cover with text A Guide to Salesforce Marketing Tools

Step 6: Create the Flow to update your Dated Exchange Rates

  1. Click ‘Setup’

  2. In the Quick Find box, type ‘Flows’

  3. Select Flows, then click ‘New Flow’

  4. Select the Scheduled-Triggered Flow, click ‘Create’, and configure as you need.  In this use case, Wilson configured as follows:

Screenshot of Salesforce schedule setting

Step 7: Create a Wait for Conditions Element

  1. Click the + icon, and select ‘Wait for Condition’ element.

  2. Enter ‘Pause’ in the Label field and the API name will auto-populate.

  3. Click on ‘Wait Configuration Details’

  4. Name the pause configuration ‘0 Hours’

  5. Click ‘Resume Event’

  6. Resume Event Conditions:

  • Wait Until: A Specified Time

  • Time Source: Specific Time

  • Base Time: {!$Flow.CurrentDateTime}

  • Offset Number: 0

  • Offset unit(Hours or Days): Hours 

Screenshot of Edit Wait for Conditions

7. Click ‘Done’

Switch to ‘Free-Form’ and back to ‘Auto-Layout’ so that your flow looks like this:

Screenshot of Salesforce Flow

Step 8: Configure a HTTP GET Callout Action

  1. Click the + icon under ‘0 Hours’

  2. Select ‘Action’ element

  3. Click + Create HTTP Callout bottom left of the screen

  4. Name the callout ‘currencyapi’

  5. Select the ‘Named Credential’ from the dropdown you created earlier

  6. Click ‘Next’

On the next screen, complete as follows:

  • Label name: Currencyapi

  • Method: GET

  • Url Path: /v3/latest

7. Add the following ‘Set Query Parameter Keys’

a) Click ‘Add Key’

  • Key: base_currency

  • Data Type: String

  • Required: True

b) Click ‘Add Key’

  • Key: apikey

  • Data Type: String

  • Required: True

Screenshot of query parameters string

You now need to add a sample JSON response.

8. Navigate back to your currency API Dashboard

9. Click ‘Request Playground’

10. Set your conditions as per your currencies

11. Click ‘Send’

12. Copy ‘Response’

Screenshot of API response

Now, move back to the flow and;

13. Click ‘New’ next to ‘Provide Sample Response’

14. Enter Description Name: Sample JSON

15. Paste: Sample Response from CurrencyAPI  

16. Click: Review

Screenshot of sample API response

17. Click ‘Done’

18. Click ‘Save’

Flow Builder creates the action and the External Service.  A new Action window appears automatically.

19. Label Name: Currency API Callout

20. Apikey: Enter your apikey (You can copy this from the currency API dashboard)

https://api.currencyapi.com/v3/latest?apikey=YOUR_API_KEY_GOES_HERE

21. Choose base currency: i.e. GBP

Screenshot of New Action API callout

Note: At this stage, you can create a Constant Variable to store your API key and add the variable to your value. The data type of this constant is (Text).

22. Click ‘Done’

Step 9: Check for a successful Currency API Callout Response

  1. Click the + under your new Action (Currency API Callout)

  2. Label Name: Check Callout Response (API Name will Auto Populate)

  3. Under Outcome Details Label Name: Successful (API will name Auto Populate)

  4. Conditions: All Conditions Are Met (and)

  5. Resource: {!CurrencyAPI_Callout.responseCode}

  6. Operator: Equals

  7. Value: 200

  8. Click Default and Named it: Unsuccessful

Screenshot of New Decision API callout

9. Click ‘Done’

10. Switch to ‘Free-Form’ and back to ‘Auto-Layout’ so that your flow looks like this:

Screenshot of Salesforce Flow Layout

Step 10: Add a Get Records Element to check for active currencies

  1. Click the + symbol under the successful line of your last decision Element

  2. Select ‘Get Records’

  3. Label Name: Get Active Currencies (API Name will Auto-populate)

  4. Object: Currency Type

  5. Condition Requirement: All Conditions Are Met (and)

  6. Field: IsActive

  7. Operator: Equals

  8. Value: {!$GlobalConstant.True}

  9. Click: ‘Add Condition’

  10. Field: IsCoporate

  11. Operator: Equals

  12. Value: {!$GlobalConstant.False}

  13. Sort Order: Not Sorted

  14. How Many Records to Store: (Check) All Records

  15. How to Store Record Data: (Check) Automatically Store all Fields

Screenshot of Salesforce New Get Records

16. Click ‘Done’

Step 11: Add a Decision Element to check for any active currencies

  1. Click the + symbol under ‘Get Active Currencies’

  2. Label Name: Active Currencies Found

  3. First Outcome Details Label Name: Yes (API Name will auto-populate)

  4. Condition Requirements: All Conditions Are Met (AND)

  5. Resource: {!Active_Currency}

  6. Operator: Is Null

  7. Value: {!$GlobalConstant.False}

  8. Default Outcome Label Name: No

Screenshot of Salesforce New Decision found

9. Click ‘Done’

If everything is going well your flow should look like this:

Screenshot of Salesforce Flow progress

It’s okay to take a break, we have covered a lot - but don’t forget to save your progress so far!

10. Click ‘Save’

11. Name your Flow: Update Exchange Rates

Step 12: Add a Loop Element to cycle through active currencies

  1. Under the Yes node: Click the + Symbol

  2. Click: Add Loop Element

  3. Label Name: Loop Through Currencies (API Name will auto-populate)

  4. Collection Varaible: {!Get_Active_Currencies}

  5. Direction: First item to last item

Screenshot of Salesforce New Loop

6. Click ‘Done’

Step 13: Create two Record Variables to store Currency Exchange Rates

  1. Click: Toolbox

  2. Click: New Resource

  3. Resource Type: Variable

  4. API Name: VarR_DatedConversionRate

  5. Data Type: Record

  6. Object: Dated Conversion Rate

  7. Check: Available for input and Available for output

Screenshot of Salesforce Edit Variable

8. Click ‘Done’

9. Click: New Resource

10. Resource Type: Variable

11. API Name: VarR_DatedConversionRates

12. Data Type: Record

13. Check: Allow Multiple Values (collection)

14. Object: Dated Conversion Rate

15. Check: Available for input and Available for output

Screenshot of Salesforce New Resource

Step 14: Create a formula to determine the latest Rate for Currency IsoCode

  1. Click: Toolbox

  2. Click: New Resource

  3. API Name: CurrencyExchangeRates

  4. Data Type: Number

  5. Decimal Places: 4

  6. Paste the below formula:

If(ISPICKVAL({!Loop.IsoCode}, "AUD"), {!Currency_API_Callout.2XX.data.AUD.value},

If(ISPICKVAL({!Loop.IsoCode}, "USD"), {!Currency_API_Callout.2XX.data.USD.value},

If(ISPICKVAL({!Loop.IsoCode}, "EUR"), {!Currency_API_Callout.2XX.data.EUR.value}, 0.000)))

You will need to add additional formula lines for each currency and add a bracket ) to the end of the formula. As I only have three currencies in my Org and don’t plan on adding more, I have three lines of formula so I add three brackets ))) to the end.

It is highly recommended at this stage to add the most common currencies up to 3900 (Flow Limit). If you go over this limit you will need to create an additional Formula Variable and replace 0.000))) in the first formula with the API name of the second formula {!CurrencyExchangeRate2}))) which could look like this:

If(ISPICKVAL({!Loop.IsoCode}, "AUD"), {!Currency_API_Callout.2XX.data.AUD.value},

If(ISPICKVAL({!Loop.IsoCode}, "USD"), {!Currency_API_Callout.2XX.data.USD.value},

If(ISPICKVAL({!Loop.IsoCode}, "EUR"), {!Currency_API_Callout.2XX.data.EUR.value},

{!CurrencyExchangeRate2})))

And your second formula would look like this

If(ISPICKVAL({!Loop.IsoCode}, "AUD"), !Currency_API_Callout.2XX.data.AUD.value},

If(ISPICKVAL({!Loop.IsoCode}, "USD"), {!Currency_API_Callout.2XX.data.USD.value},

If(ISPICKVAL({!Loop.IsoCode}, "EUR"), {!Currency_API_Callout.2XX.data.EUR.value}, 0.000)))

And so on until each 3900 limit is reached per formula. An alternative approach would be to use APEX Class to overcome limits within flows.

Here is a formula for the 10 most-used currencies

If(ISPICKVAL({!Loop.IsoCode}, "USD"), {!Currency_API_Callout.2XX.data.USD.value},

If(ISPICKVAL({!Loop.IsoCode}, "EUR"), {!Currency_API_Callout.2XX.data.EUR.value},

If(ISPICKVAL({!Loop.IsoCode}, "JPY"), {!Currency_API_Callout.2XX.data.JPY.value}, 

If(ISPICKVAL({!Loop.IsoCode}, "GBP"), {!Currency_API_Callout.2XX.data.GBP.value},

If(ISPICKVAL({!Loop.IsoCode}, "AUD"), {!Currency_API_Callout.2XX.data.AUD.value},

If(ISPICKVAL({!Loop.IsoCode}, "CAD"), {!Currency_API_Callout.2XX.data.CAD.value},

If(ISPICKVAL({!Loop.IsoCode}, "CHF"), {!Currency_API_Callout.2XX.data.CHF.value},

If(ISPICKVAL({!Loop.IsoCode}, "CNH"), {!Currency_API_Callout.2XX.data.CNH.value},

If(ISPICKVAL({!Loop.IsoCode}, "HKD"), {!Currency_API_Callout.2XX.data.HKD.value},

If(ISPICKVAL({!Loop.IsoCode}, "NZD"), {!Currency_API_Callout.2XX.data.NZD.value}, 0.000))))))))))

Do not include your Corporate Currency and always ‘Check Syntax’ to make sure your formula works.

Screenshot of Salesforce API formula

Step 15: Add an Assignment Element to assign values to a Record Variable

  1. Label Name: DatedConversionRate Mapping

  2. Set Variable Values:

  • Row 1:

    • Filed: {!VarR_DatedConversionRate.StartDate}

    • Operator: Equals

    • Value: {!$Flow.CurrentDate}

  • Row 2:

    • Filed: {!VarR_DatedConversionRate.IsoCode}

    • Operator: Equals

    • Value: {!Loop.IsoCode}

  • Row 3:

    • Filed: {!VarR_DatedConversionRate.ConversionRate}

    • Operator: Equals

    • Value: {!CurencyExchangeRates}

Screenshot of Salesforce Edit Assignment

Step 16: Add an Assignment Element below the above element

  1. Click the + Symbol, below Dated ConversionRate Mapping Assignment

  2. Label Name: Add to Collection (API name will auto-populate)

  3. Set Variables

  • Row 1:

    • Filed: {!VarR_DatedConversionRates}

    • Operator: Add

    • Value: {!VarR_DatedConversionRate}

Screenshot of Salesforce Edit Assignment values

Step 17: Add a Create Records Element 'After Last' in the loop Element

  1. Click the + Symbol

  2. Label Name: Insert DatedConversionRates

  3. How Many Records to Create Checkbox: Multiple

  4. Record Collection: {!VarR_DatedConversionRates}

Screenshot of Salesforce Edit Create Records

5. Click ‘Done’

6. Click ‘Save’ to save the entire flow

Now that Wilson has completed his flow, it will look like this:

Screenshot of Salesforce Flow completed

Before moving the flow to a production Org, it's time to Debug and test. It would be good at this point to note down the current rates of your currencies and set the running user for your process as an Admin from ‘Process Automation Settings’, if not already done.

Step 18 (final step!): Debug the Flow

  1. Click: Debug

As you have built this flow in a sandbox, do not select the ‘Run flow in rollback mode’ checkbox. You want to check that the rates have been updated from the currency screen. If you are building in a Production Org (not recommended!), then you can click ‘Run flow in rollback mode’ to revert all records back to their original state. 

2. Click ‘Run’

Screenshot of Salesforce Debug flow

You will get a result like this:

Screenshot of Salesforce Debug flow result

And you’re done! You can now launch in your live Sales Cloud account.

There is only one small limitation with this flow: it only allows you to insert new currencies once a day and once this action has been completed you will get an error message stating that the flow has failed if you try to insert again. If you need to update multiple times per day, the AppExchange is a great place to find a solution, or use the update element at the end instead of the ‘Create Element’. You will need to Add IDs to the variables to accomplish this.

If you’ve reached the end of this post feeling overwhelmed by the technical setup required, feel free to reach out to MarCloud and we can discuss a flexible Sales Cloud support package for you.

Grayscale headshot of Robbie Bain

Robbie Bain

With 28 years of experience in the British Army and a successful track record as a Salesforce Solution Engineer, Robbie brings a unique blend of leadership and technical expertise to the table. His ability to translate customer needs into innovative solutions, coupled with expertise in managing complex projects, makes him a valuable asset in driving customer success within the Salesforce ecosystem or as an administrator.

More by Robbie Bain

Featured resource

3D eBook cover with text A Guide to Salesforce Marketing Tools

Salesforce Marketing Tools

With the eBook ‘A Guide to Salesforce Marketing Tools’ in your arsenal, you’ll have a go-to, comprehensive, expert guide to understanding and selecting your perfect Salesforce marketing platform(s), be it Marketing Cloud Account Engagement (Pardot) or Engagement, and the products available to each.

Download now
View all resources

More recent posts

View all articles
Illustrated characters holding a MarCloud banner

Sign up to the MarCloud Newsletter

MarCloud is a team of certified Pardot, Marketing Cloud, and Salesforce specialists. We help businesses to unlock the potential of marketing automation. Sign up to receive regular Marketing Cloud content to help you align your technology with your business goals.

Sign up to the newsletter

Free Guide to Salesforce Tools

With the eBook ‘A Guide to Salesforce Marketing Tools’ in your arsenal, you’ll have a go-to, comprehensive, expert guide to understanding and selecting your perfect Salesforce marketing platform(s).

Download now