
I am creating a Canvas application for a car and bus leasing solution.
I have a basic form and want to add multiple Bus and Car forms for each client and save it as each client may lease multiple cars and buses. So I want to capture details for each car and bus leased to a client and save details.
Example:
User will fill up the form for the new customer with basic details and ask the customer for the total number of cars and buses the customer will lease.
Customer A may lease 3 cars and 2 buses.
Customer B may lease 5 cars and no buses.
For Customer A:
(Example: Customer A saved details will include basic form details and 3 cars forms details and 2 bus forms details. AND Customer B saved details will include basic form details and 5 bus forms details.)
Attaching screenshots of screen design and database table concept diagram to this request.
I am using Canvas and Dataverse.
I designed a form with basic form control fields and car form control fields and kept car form control fields hidden until the user pressed the car button.
I am able to save the form however I am unable to add multiple car and bus forms and save it to the same customer record.
Any help or guidance or ideas on how to go about this scenario will be appreciated.
To create and add multiple forms for each car and bus leased to a customer in your Canvas app and save them to the same customer record in Dataverse, you can follow these steps:
1. Set up your Data Model:
- In Dataverse, create two additional tables: one for cars and one for buses.
- Each table should have columns to store the relevant details for cars and buses respectively.
- Establish a relationship between the customer table and the car/buses tables using a lookup field, so each car/buses record is linked to a specific customer.
2. Designing the App:
- Create a screen for the basic customer details form.
- Add input controls for the basic customer details and a button to save the details.
- Create separate screens for the car form and the bus form.
- On the basic customer details screen, place icons or buttons for adding cars and buses.
- When the car icon/button is clicked, navigate to the car form screen, and when the bus icon/button is clicked, navigate to the bus form screen.
- On the car and bus form screens, add the necessary input controls for car and bus details, along with a save button.
3. Saving the Data:
- When the user fills in the basic customer details and clicks the save button, create a new customer record in the Dataverse customer table.
- Retrieve the newly created customer record's unique identifier (GUID) and store it in a variable.
- When the user fills in the car details and clicks the save button on the car form screen, create a new record in the Dataverse cars table.
- Set the lookup field in the cars table to the unique identifier of the corresponding customer record.
- Repeat the same process for saving bus details to the buses table, linking it to the customer record using the lookup field.
4. Displaying the Data:
- To display the saved data for each customer, you can use galleries or other controls on a separate screen.
- Retrieve the cars and buses records linked to a specific customer by filtering the cars and buses tables based on the customer's unique identifier.
- Display the relevant car and bus details using the galleries or controls, based on the retrieved records.
By following these steps, you can create multiple car and bus forms, link them to the specific customer record, and save them separately in the Dataverse. This allows you to capture details for each car and bus leased to a customer and associate them with the correct customer record.