HTTP Callouts

Salesforce flow calling an exchange rates API in 90 seconds. Uses template strings, URL variables, the dot operator to traverse JSON collections, and math commands. Returns data available as a flow resource.

 


 

Note the free exchange rate service used in this video is unavailable since October 2023

 

Transcript:

 

Intro

Here's a quick demo. Let's say the US sales team needs the Japanese price list updated regularly. We'll calculate those prices using an average exchange rate over a month using Streamscript.

 

Set the start/end dates

We begin with a start date.

I'll create a date resource and we'll do the same for the month end. Next, we use a Streamscript step and paste in the exchange rate logic.

 

Demo the exchange rate logic

Click save and then click Debug. Our script ran. It used the start date and end date to define the month range to call out to the exchange rate service and calculated the average rate.

 

Using merge fields for the URL

Let's take a closer look at this logic in detail. We built up the URL using the start date and end date from those flow variables.

 

HTTP GET command

Then we call out to the rate service.

 

Show the JSON manually

You could also try this in your web browser like this.

Finally, we use the average command to extract and loop over the Japanese rates. Because we return the average, it becomes available in the outputs on the Flow canvas.

 

Return the average

So summing up, we needed exchange rates for a price list. We called out to a service to get the data using Streamscript. Then we calculated the average and the result can now be used in Flow.

 

 

 

Getting started with Streamscript
Install from the Salesforce AppExchange
Package install link: /packaging/installPackage.apexp?p0=04tGA000005R8Ny