(Deprecated) Budibase Docs
  • đź‘‹Introduction
  • Quickstart tutorials
    • Build a CRUD app
      • Importing the Vehicles table from a CSV
      • Creating the Service log table from scratch
      • Listing recent Service Logs on the home screen
      • Creating a new Service Log with a modal
    • Build a CRUD app- SQL
      • Connecting to your SQL tables
      • Creating Screens from your SQL tables
      • Using relationships between SQL tables
      • Creating a List screen from scratch, using a SQL table
      • Creating a new log, with a modal
    • Build a CRUD app - REST
      • Adding a REST datasource
      • Creating a query that Lists Issues
      • Using your request to display items in your app
      • Add a “Create Item” request
      • Create a new todo Item, inline
      • Mark todo items as “Done”
      • Finishing Touches
  • Building apps
    • Data
      • Users table
      • Data sources
        • Internal/CSV
        • PostgreSQL and MySQL
        • REST
          • REST Queries
          • REST Bindings Example
          • REST Query Import
          • REST Authentication
          • REST Variables
        • Other sources
      • Data Types
        • Text
        • Number
        • True/False (Boolean)
        • Date/time
        • Options
        • Attachments
          • Example
        • Relationships
          • Example
        • Formula
        • JSON
      • Views
        • Filters
        • Calculations
        • Groups
      • Transformers
    • Design
      • Screens
      • Layouts
      • Components
        • Section
        • Container
        • Data Provider
        • Repeater
        • Table
        • Chart
        • Card
        • Text
        • Button
        • Link
        • Icon
        • Image
        • Embed
      • Forms
        • Form Component
        • Field Groups
        • Fields
      • Bindings
      • Actions
      • App State
      • Conditions
      • App theming (coming soon)
      • Handling Data
        • Search/Filter Data
    • Automate
      • Automation steps
        • Triggers
        • Logic
        • Actions
      • Activating and testing
      • Contextual bindings
    • Admin and management
      • User Management
      • Authentication and SSO
        • OpenID Connect
        • SSO with Auth0
        • SSO with Azure AD
        • SSO with Okta
        • SSO with OneLogin
        • SSO with Google
        • SSO with Keycloak
      • Email
      • Portal
      • User Settings
  • Guides
    • Display user-related data
    • Add search
    • Add filtering
    • Create public & private screens
    • Writing a custom SQL query
    • Create a child record from the parent
    • Items assigned to me
    • Master-detail
  • Self-hosting
    • Get started
      • Budibase CLI Setup
    • Hosting methods
      • Overview
      • DigitalOcean
      • Kubernetes (K8S)
      • Docker compose
    • Hosting settings
      • Advanced options
        • Reverse proxy
    • Accessing CouchDB
    • Accessing MinIO
  • References
    • Budibase architecture
    • Deployment information
    • Troubleshooting
    • Contributing to Budibase
      • Writing Your Own External Data Connectors
Powered by GitBook
On this page
Export as PDF
  1. Guides

Create a child record from the parent

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.

PreviousWriting a custom SQL queryNextItems assigned to me

Last updated 3 years ago

In this example, we have a “Customer” record, with “Notes” attached to it. One Customer has many notes.

We will build a screen that

  1. Lists all notes for a customer.

  2. Has a “Create Note” button, which allows a new note to be added via a modal

  3. 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:

  1. Add a new Data Provider, inside the Repeater.

  2. Set the Data property to “Repeater.Customer.Notes”. This will depend on your table and column names - i.e. “Repeater.Parent Table.Relationship Column”.

  3. Add a table to your data provider.

Next, we will build our “New Notes” modal - our child record.

  1. Add a new screen.

  2. Set the URL to /notes/new/row/:customerid

  3. Choose “Notes - Detail”.

  4. Click on the “Save” buttons, and “Define Action”.

  5. Remove the final action for “Navigate to”.

  6. Add an action for “Close Modal”.

  7. Click on the “Save Row” action.

  8. Click “Add Column”, and choose the “Customer” column (the parent record).

  9. 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.

  1. Create a new button, and position it.

  2. Click on the “Define Actions” setting.

  3. Add the action “Navigate To”.

  4. 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!

45KB
parent-child-app.json