This guide demonstrates how to create a child record, from the parent record. These instructions should work with a SQL connection or the Budibase Internal DB.
In this example, we have a “Customer” record, with “Notes” attached to it. One Customer has many notes.
We will build a screen that
Lists all notes for a customer.
Has a “Create Note” button, which allows a new note to be added via a modal
Refreshes the notes list when the modal closes.
You can import my full example app to see exactly how it’s done:
Starting with a standard “Customer Detail” screen will first add the list of notes belonging to that customer:
Add a new Data Provider, inside the Repeater.
Set the Data property to “Repeater.Customer.Notes”. This will depend on your table and column names - i.e. “Repeater.Parent Table.Relationship Column”.
Add a table to your data provider.
Next, we will build our “New Notes” modal - our child record.
Add a new screen.
Set the URL to /notes/new/row/:customerid
Choose “Notes - Detail”.
Click on the “Save” buttons, and “Define Action”.
Remove the final action for “Navigate to”.
Add an action for “Close Modal”.
Click on the “Save Row” action.
Click “Add Column”, and choose the “Customer” column (the parent record).
For its value, use {{ URL.customerid }}
- this links to the parent customer, via the :customerid
URL parameter.
Finally, we will add a button that will open our screen in a modal.
Create a new button, and position it.
Click on the “Define Actions” setting.
Add the action “Navigate To”.
Set the URL to your “New child” screen. You will need to pass the Parent Record’s ID into the URL. For me, It’s “/notes/new/row/{{ Repeater.Customer._id }}”. If you are using SQL, use your parent table’s primary key.
Now - test your app!