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. The remote lookup allows you to do either a GET or POST request. This example is a GET.
Header and Body
Next, you can add HEADER and BODY parameters in the API request. This is useful when you are making authenticated calls to other API services.
In this example, we'll add the access key in the body. 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 in CurrencyLayer. Note that with CurrencyLayer’s free account, your source currency will always be USD.
JSON path of value in result
To display the computed values in a specified format, enter this in the JSON path. These are specific to whichever URL you are calling.
In our case, the JSON path will be:
How should the result be chosen?
You can choose whether or not to display a dropdown, or autopopulate a response. For this example, we'll choose autopopulate.
The live form
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.
In this example, we've also added a field to display the total calculated value in GBP. It is a number field with the formula:
PO_Value.value() * number(GBP_Conversion_Rate)
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
Reduce the number of remote fields by storing the entire JSON/XML data from one call instead of just a particular value and using JSON_EXTRACT formula in other fields.