Explained: How to build forms with dynamic selection

Learn how to get data from a database or external sheet into Next Matter and build dynamic drop-downs with the data.

Workflow builder

PostgreSQL integration

In this tutorial we're getting data from a table in PostgreSQL, using the data to build a dropdown, sending an external user an email step with the link to the drop-down to make a selection, and sending them a confirmation email with the selected item specified.

📘

The drop-downs are dynamic so when new items are added to the PostgreSQL table, they will be reflected in the dropdown.

Google Sheets integration

In this tutorial we're getting data from a table in Google Sheets, using the data to build a dropdown. The dropdown is dynamic, which means that any change to the Google Sheets will result in a change in the dropdown when a new instance is run.


The URL we're calling is: https://sheets.googleapis.com/v4/spreadsheets/1J5F8TzXhLJ2V9rpRoAVG5ppBTbh74sdeodXJ6mO3Hrg/values/TEST!A2:B100/ and contains the sheet ID, name and range. For details, see Connect with Google Sheets.

Good to know: JSON format

The source of a dynamic drop-down needs to be a JSON list.

A JSON list (array) contains zero, one, or more ordered elements, separated by a comma. The JSON array is surrounded by square brackets [ ]. Each element is in double quotes.

📘

Note that when you have a key=value pair (["name":"John"]), we'll only display the value in the dropdown.
For dynamic dropdowns, this looks like the following: [["key1", "value1"],["key2", "value2"]].

When you create a dropdown from, for example, Google Sheets, using a data reference, make sure to select the data reference in (json) format.

Lists for dynamic dropdowns

When you want to create a dynamic dropdown from a JSON list, and you're creating a variable to refer to this list that you later use as a source of the dynamic dropdown, make sure you use [*] in the variable value.
For example, $.mylist[*]. This will ensure the list is parsed correctly.

👍

To make the response of the Excel No Code step compatible as input for the dynamic dropdown, enter this value in the Variable value in the No code step and use the data reference as the dropdown source:

$.["Range Values"][*].values[0].