Remote lookup

Updated 3 weeks ago by Nandini

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

One of the most common use cases is getting a current currency exchange rate. For example, let’s say you want to convert a purchase order that was entered in USD into GBP.  

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

Configuring the Remote lookup field

Add a remote lookup field called GBP Conversion Rate.

URL and Request type

In the URL field, enter the URL to direct toward the API.

In this example, we are going to get the conversion URL 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

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.

$.quotes.USD[CurrencyType]

In our case, the JSON path will be:

$.quotes.USDGBP

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)

Extracting data with a remote lookup

You can also use a remote lookup field to extract data from an external API. Here are some examples

Remotelookup_Fieldname.extractNumber(path, index)

Remotelookup_Fieldname.extractText(path, index)

Remotelookup_Fieldname.extractJson(path, index)

For example, I want to display the grocery items with periodic pricing from an external API in my form table. 

Sample JSON that I want to extract:

{

      "timestamp": "1563179703",

      "state": "Andhra Pradesh",

      "district": "Chittor",

      "market": "Palamaner",

      "commodity": "Carrot",

      "variety": "Carrot",

      "arrival_date": "15/07/2019",

      "min_price": "875",

      "max_price": "1375",

      "modal_price": "1125"

    }

In the Kissflow form, let’s start with a remote lookup field called Item Name that shows the list of items within a table. 

  1. Add an API link in the URL field.
  2. Then choose GET as the request type.
  3. Provide a Header name as Content-Type and Value as application/json.
  4. Enter a JSON path of value in result: In my case, it will be $.records[*].
  5. In the field, What kind of data are you working with? choose JSON.
  6. In the field, How should the result be chosen? choose Select a value from the dropdown.

Then add a currency field called Unit Price, with the formula:

currency(Item_Name_1.extractNumber("$.modal_price", 1), "USD")

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

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.


How did we do?