Using remote lookup field to get currency exchange rate

The remote lookup field is a great way to get data from external systems into your form. 

Using JSON for a currency exchange rate

Let’s look at a common use case of getting a current currency exchange rate. We want to convert an order that was entered in USD into GBP.  

In the Kissflow form, start with a currency field called PO Value that shows the total price of the PO in USD.

Then add a remote lookup field called GBP Conversion Rate. In the URL field, enter the URL to direct toward the API.

In this example, we are going to get the conversion URL to use an API from CurrencyLayer, a 3rd party API. You can sign up for a free account at https://currencylayer.com/product

Back in the Kissflow form, enter this link in the URL field http://www.apilayer.net/api/live. You need to provide the access key in the body section. 

  1. The remote lookup allows to do either a GET or POST request. This example is a GET
  2. Next, you can add HEADER and BODY parameters in the API request. These are useful when you are making authenticated calls to other API services. 
  3. Click +Add Body, then in the name field type access_key. In the value field, enter the actual access key. Find your access key in Step 3 of the Quickstart guide from CurrencyLayer. With CurrencyLayer’s free account, your source currency will always be USD. 
  4. In the field, What is the format of the response data you are working with?, choose JSON.
  5. In JSON path of value in result, enter $.quotes.USD[CurrencyType]. In our case, the JSON path will be: $.quotes.USDGBP.
  6. In What kind of data are you working with?, choose Text.
  7. In How should the result be chosen?, choose Autopopulate a value

In the live form, you’ll see a button for GET requests that says Get Data. Click the button and Kissflow will perform a remote call and fetch the live value.  

If you want to automatically calculate the converted amount, add a new currency field with two decimal places called PO in GBP. Mark it as a computed field and enter the formula:

PO_Value.value() * number(GBP_Conversion_Rate)

Pro tips

In addition to currency rates, you can use the remote lookup field to:

  • Get stock and bullion rates
  • Refer to data on a different MDM system