Form data can be used to update a row. If a respondent fills out a form, we may want to update data in an existing row, instead of creating a new row.
Respondents can manage their own information via forms. For example, if a user inputs their contact details, this data can be changed using forms without access to the database. We will match an existing row in a pre-populated form to update that specific existing row.
In this tutorial, we will manage a feature request process to keep track of in-demand features to provide a better user experience.
Now, let’s update rows with form submissions.
Log in to Baserow. If you haven’t already, create an account on a hosted baserow.io or a self-hosted instance.
We need to set up a workspace and add a database to the workspace. The first step is to create a workspace.
Next, create a new database within the workspace. To create a database from scratch, select ‘+ Create new’ and enter the database name as ‘Feature Requests’. Then click the ‘Add database’ button.
A default table will be created when you start from scratch.
The next step is to add tables. We will create two basic tables within the database.
First, create a table that will contain the new features. This Features table will hold information about desired features, as well as the demand or appreciation for each of these.
The following fields will be added to the Features table:
Field name | Field type |
---|---|
featureID | Single line text |
Title | Single line text |
Description | Long text |
Category | Single select |
Priority | Rating |
Initiate | Date |
Deadline | Date |
Completed | Date |
Prefilled URL | Formula |
The Prefilled URL formula field combines the share form URL from the Update table (Table B) with the prefilled values of the row to be updated. Further details are provided in step 4 below.
Next, create a new form view to collect new feature requests. To create a form view in your table, click the existing view at the top of the table and select ‘Form +’ from the modal. Name the view then click ‘Add form’ to add a form.
Create a shareable link to share the form publicly by clicking the ‘Share form’ link at the top bar. The link can be shared to add a new submission to the database. A new form submission will create a new row in the Features table.
Next, we want to link the requests collected to the Features table so that when a new update request comes in, it will copy and paste it into the row with a corresponding row ID.
First, duplicate the Features table without the row data. This Update table will hold information about existing features, with the same exact fields we want to update in the Features table.
To duplicate a table, click on the three dots ⋮
icon next to a table. Select the ‘Duplicate’ option from the dropdown. The grid and form views will be duplicated to collect update requests.
Rename this table as ‘Update’, then rename the featureID field as updateID. The updateID will contain the ID of the row to be updated.
Navigate to the form view in the Update table and create a shareable link to share the form publicly.
This table will contain updated entries. When a form is submitted, a new row will be added to the Update table.
Next, we want to prefill and hide fields available in the Update form view. Forms can be prefilled to help the user fill in the form faster. You can use query parameters added to the public form URL to prefill a form with data.
The pre-filled values will pull the required data from the database. To prefill the Update form using data from the Features table dynamically,
Copy the generated share link URL from the Update form view.
Add the URL parameters to prefill the updateID in the format: ?prefill_<field_name>=<value>
. You can add more fields to be prefilled automatically, e.g. the Title.
To hide the updateID field from the form, prefix the query parameters with hide_
. Note that this still exposes the info in the URL, but will hide the field from being edited.
<form-URL>?prefill_updateID=<featureID>&hide_updateID
If you want to prefill multiple field types you can do so by adding &
ampersand symbol between the values. For example,
?prefill_Priority=2&prefill_Category=Enterprise,Accessibility
Create a formula field in the Features table and use the CONCAT function to combine the text from multiple ranges and/or strings. Paste the form URL generated above to the formula field in the Features table.
```
link(concat('<form-URL>?prefill_updateID=',field('featureID'),'&hide_updateID'))
```
> The Prefilled URL formula field in the **Features** table (Table A) combines the share form URL from the **Update** table (Table B) with the prefilled and hidden field values of the row ID to be updated.
>
When the prefilled formula-generated URL is clicked, the updateID will be populated with the featureID. To update a feature row, share the prefilled URL.
Next, we will use n8n, a workflow automation platform, to connect Baserow with other apps.
Log in to n8n. There are different ways to set up n8n depending on how you intend to use it. Choose a preferred way to set up n8n.
Before you integrate an app or service with n8n, you need to add credentials that will be needed in the later steps. We need to set up these prerequisites. Learn how to add your Baserow credentials to n8n here.
Next, we want to set a trigger to listen for when a form is submitted.
Before we add our regular nodes, we want to set up a trigger to listen for the webhook. Webhooks allow you to send notifications whenever a new form response is submitted. By integrating your Baserow webhook with n8n, we make sure that every piece of data collected through your form goes directly to where it needs to be for you to do something with it.
We want to pull in data from our Baserow table with the n8n Webhook node. n8n Webhook node is a Trigger node that serves as the starting point for an n8n workflow. It allows you to create webhooks that can be used to receive data from Baserow when an event occurs.
Add the webhook node to your new workflow. Search for ‘Webhook’ and add the trigger node to a new workflow. This starts the workflow when a webhook is called:
Clicking on the webhook node will reveal the parameters section to configure the node. Within this section, you can view the URLs for the webhook.
n8n recommends using a test webhook URL when creating or testing a workflow. This ensures that the incoming data can be viewed in the Editor UI, which is useful for debugging.
Choose the POST
HTTP method. POST requests are typically used to send data to a resource for a create/update operation.
Copy the test webhook URL. Next, let’s put the test URL to use by making a POST request in Baserow.
We will create a webhook to call the n8n pipeline that generates the update.
Now that we have the webhook URL, we need to configure the application with this webhook URL to set up the trigger.
Go back to Baserow to create a webhook triggered on row creation. Webhooks can inform 3rd party systems when rows in Baserow have been created, updated or deleted.
Create a new webhook in the Update table. Select the method as POST and paste the webhook URL copied from n8n to receive requests. Select the events to trigger the webhook.
Back in n8n, click the ‘Listen for test event’ button.
While Listening for the test event on n8n, back in Baserow, click the ‘Trigger test webhook’ button on the webhook modal. You will receive a 200 OK response.
The Test webhook is only registered in the time between executing a workflow via the UI and until the first call gets made (when it displays “waiting for Webhook call”).
We want to sync data to update the fields of the row identified by the ID. For example, if a respondent fills out update details, the data is populated in the Updates table then the automation will find the existing feature details in the Features Table and copy the data entered and input it into the corresponding row.
We want to search for the prefilled updateID in the Features table.
Search and add the Baserow node to the workflow:
Click the Baserow node to reveal the parameters to configure. Within this section,
Select the credential for Baserow API configured to authenticate the Baserow node in n8n.
Select “Row” as the Resource
Select “Get Many” as the Operation
Select “Feature Requests” from the list as the Database to operate on, or specify an ID using an n8n expression.
Select “Features” from the list as the Table to operate on, or specify an ID using an n8n expression.
Map the search term to match as UpdateID. Click on ‘Expression’ to write the expression in the expression editor. Browse and select the updateID from the webhook data in the Variable selector.
n8n expressions allow you to set node parameters dynamically based on data from a previous node. If you don’t see your webhook data, add a new row to the table then trigger webhook.
Click the ‘Execute node’ button to get a response. The output will display the corresponding row in the Features table.
We want to reference the ID and specify which fields to be filled or edited with the updated info from the row.
Add another Baserow node to the workflow. Configure the parameters:
{{$node["Baserow"].json["id"]}}
. Within the expression result pane, you can see the rendered result.Click the ‘Execute node’ button to get a response. The output will display the rows in the table.
The Baserow webhook will trigger on every event when a form is submitted and a new row is created in Table B. The updated row will sync with the same row ID in Table A.
To test the workflow, trigger the workflow manually by going to the canvas and clicking ‘Execute Workflow’. After you execute the workflow, you will get a response.
The test webhook URL only works for one call after you click the ‘Execute Workflow’ button on the canvas. After the Test webhook gets called for the first time, it displays the data in the Editor UI and then gets deactivated.
After the test, the next step is to save and activate the workflow. This workflow will run as defined once you activate it. Save the workflow and then click on the Active toggle at the top of the canvas to activate the workflow. Activating will ensure that the workflow will fire automatically each time the trigger condition is met.
Once you’ve finished building your workflow, run it without having to click the execute button by using the production webhook URL. When working with a Production webhook, ensure that you have saved and activated the workflow.
Your workflow will then be triggered every time a POST request is sent to the Production webhook URL.
Data flowing through the webhook won’t be visible in the Editor UI with the Production webhook. These executions will not show up immediately in the editor, but you can see them in the execution list if you choose to save executions.
This workflow can be adapted to any use case. With batch create/update/delete rows endpoints, you can modify multiple rows at once.
A respondent can update submitted data. You can also specify when the information should be updated. For instance, whether to always update the information or only when it was previously blank.
Other tutorials:
In case you’ve run into an issue while following the tutorial, feel free to reach out to ask for help in the Baserow community.
What’s your use case? Tell us how you use Baserow