Zapier is a service that allows you to connect third party software to your Knack account for the purpose of automating the transfer of records between these services.
This guide will show you how to use Zapier to insert records into your Knack database and establish a relationship with existing records.
In this example we will insert Invoice records connected to Customer Users allowing visualization of Invoices linked to a specific Customer.
For the purposes of this example we will use Zapier to connect Google Sheets and Knack to create our "Zap."
This “Zap” will trigger when we add a new Invoice record (a row) to a Google Sheet. Zapier will then insert this record into your Knack database, specifically the Invoice object, and connect it to a Customer User.
- A Customer User Role and an Invoice object
- A one-to-many connection between Customer and Invoice where Customer is the parent object (one) and Invoice is the child object (many)
- A Zapier account
Setup Google Sheets
You will need a minimum of two fields (columns). An Account ID field and an Invoice Total field.
Setup Customer User Role
A short text field with an Account ID will be the easiest way to ensure records from Google Sheets will be connected to the Customer User record. Any unique field will work, however, the name field will not work.
Add a short text field, label it Account ID.
Set the Display Field to use the Account ID field. This is required in order for the Invoice records to connect to the Customer.
Choose Account ID in the display field setting.
Assign Unique IDs
In the records tab, assign an Account ID number to each customer. Ensure that the Account ID you assign is the same as the Account ID in your invoice records that you will be entering in the Google Sheet.
Check your Invoice Object to be sure you have your connection established. The Account ID will appear in this connection field as your records are inserted from Zapier.
Once you have created an account at www.zapier.com you can create your first “Zap.” In your dashboard click “Make a New Zap”.
Choose Trigger App
Follow the prompt to choose a trigger app, in this case Google Sheets.
Zapier will help you to choose the correct sheet and test it to be sure it works.
Choose Action App
In this step you will select Knack as the action app. There are a few standard steps to follow such as selecting the action and choosing your Knack app.
You will need your Application ID and API Key from your Knack app. This is found in the API and Code tab of the main app settings menu:
Next you will choose “Edit Template” in which you will choose your object. In our example we want to choose the Invoice object.
After your selection is made, you will assign the fields from Google Sheets to match or “map” to your fields in your Knack object.
The invoice field is relatively simple to add.
With the Invoice field chosen, you will need to assign the customer field. Since this is going to map to a connection field in Knack, we need to enter a two-step process.
First, in the Customer Field set it to “Use a Custom Value”. This will automatically create a new, second field called “Custom Value for Customer.”
In the selector, choose the field for your Account ID:
Zapier will prompt you to test the setup to be sure it will function properly. Once test is successful, you can add a new record to Google Sheets.
The test record should appear in your Knack object records.
Confirm in your app
Finally, you can view the Customer Details and the connected Invoice records in the app.
Note: If you make any changes in Knack to fields (deleting fields and re-adding them under new names, changing field types, etc.), make sure to "Refresh fields" on the Edit Template step of your Zap so that these fields can be re-connected properly in your Zap. You may find that you get a message such as the one below that will help clear up any data corruption issues when importing in to Knack.