In this article, you can learn the steps to effectively utilize an edit Form in order to create records that do not currently exist.
Use Case
You have two connected tables, and we want users to use only one form to either create a new connected record or edit the existing connected record.
For example, you may want your users to be able to add a new Sales Rep to a Lead that doesn’t have one or edit the existing Sales Rep connected to a Lead, from the same form.
Requirements
The following are requirements for creating this form:
- The connected tables must have a one-to-many or one-to-one relationship. You can read more about connection types here.
- The form view must be adding a record for the parent table in the connected tables. This means for a one-to-many connection type, the table which only has one record connected. You can read more about parent-child tables here.
In this scenario, multiple Leads are connected to a single Sales Rep. Therefore, the form can be designed to allow users to either add a new Sales Rep or edit the existing one connected to a Lead.
Steps
1. Create a Details Page
In the Pages section of the Builder, create a new Details page displaying a single Leads record.
Tip: If you need assistance with creating a details page, you can refer to this article that will guide you through the steps.
2. Add A Form to Add or Edit a Sales Rep
On the Details page for Leads, add a Form view that updates the connected Sales Rep:
3. Login & Test
Now that you have successfully set up your Form, it's time to test it in your Live App. To view your page, go to the Pages section of the Builder, simply click on the open icon or select the "Go to Live App" button.
-
Click to view the Details for a Lead that has no Sales Rep connected to it.
-
Fill out the Form you created in the first step, and click the Submit button.
-
Refresh the page to see your new Sales Rep connected to that Lead.
-
You can then edit the Sales Rep you just created from the same Form.
Congratulations! You have effectively used an edit form to create new records that do not yet exist in your database. Well done!