Exercise - Model table forms

Completed

In this exercise, you'll modify the main form for LocationTable. To begin, sign in to Power Apps and then follow these steps:

  1. From the left side navigation options, select Tables.

    Screenshot of first three steps of the exercise.

  2. Search for LocationTable that you created in the previous module. You can search for it by typing location in the search field in the upper right of the screen.

  3. Select LocationTable and then select Forms (from the Data Experiences pane). Find and select the Main information form to navigate to the forms design experience.

  4. Add the Owner (a Dataverse standard field that identifies the user who created the record in the table) to the Header section of the table by dragging the Owner field and then dropping it to the upper right of the header. (If you downloaded the solution at the beginning of this module, these steps have already been done, but you can follow along.) The image below step #7 below shows steps 4-7 to help orient you.

  5. Add the fields that a user will enter for locations in the General section of the form. As in the previous unit, the Table columns pane on the left show the different columns available in LocationsTable that can become form fields. Drag the fields and then drop them into the General section. Put the fields in the following order:

    1. LocationId

    2. LocationName

    3. LocationCountry

  6. Let's set the LocationId field to be Read-only. Select the LocationId field, and on the right side panel under Properties, select the Read-only checkbox.

  7. To complete the changes, select Save and Publish in the upper right. Your LocationTable form should resemble the image below.

    Screenshot of steps 4-7 showing the completed form.

    Now, let's test our form by adding a location record to our table with it.

  8. Return to the table's main screen for LocationTable (Tables > LocationTable).

  9. Select the Edit button from the command bar to edit the data in the table.

  10. Select the down chevron just to the right of + New row and then select New row using form to open up the form you just made in a separate browser tab.

    Screenshot showing the data table showing the New row using form option.

  11. Enter the following information into the form. Then select Save & Close in the command bar. (The LocationId field will autopopulate.)

    • LocationName - Contoso Main Factory

    • LocationCountry - Choose USA from the dropdown menu

Modify the main form for TypeofAccidentTable

Follow these steps to modify the main form for TypeofAccidentTable:

  1. Go to back your list of Tables in Power Apps.

  2. Search for TypeofAccidentTable that you created in the previous module. Remember, you can search for it by typing typeofaccident in the search field.

  3. Select the table and then select Forms (from the Data experiences pane). Then select the Main information form to navigate to the forms design experience.

  4. Drag and drop the Owner field to the Header section of the table.

  5. Add the fields that a user will use for the type of accidents in the General section of the form. Drag the fields and then drop them in the General section. Put them in the following order:

    1. TypeofAccidentId (this field might already be on the form)

    2. AccidentName

    3. AccidentSeverity

  6. Set the TypeofAccidentId field as read-only. Select the TypeofAccidentId field, and on the right under Properties, check the box next to Read-only.

  7. To complete the changes, select Save and Publish in the upper right.

    Now, let's use your new form to add some data to the TypeofAccidentTable table.

  8. Return to the Tables main screen for TypeofAccidentTable.

  9. Select the Edit button from the command bar to get to the data edit screen. In the command bar, select the down chevron just to the right of + New row, then select New row using form from the dropdown.

  10. In a new browser tab, your form opens. Enter the information below into the form:

    • AccidentName - Slip and Fall

    • AccidentSeverity - Select 2 from the dropdown menu

  11. Select Save & Close from the command bar. You should now see the data entered into your table.

Modify the Main form for the AccidentTable

The process for modifying the AccidentTable form is the same as the previous processes. The difference with this one is that you'll create a one-column tab in the General area to group the general accident information fields. Then, you'll create another one-column tab in the General area to group the manager fields. Also, you'll add a subgrid so that users can add employees that were involved in a particular accident.

  1. Return to the Power Apps list of Tables.

  2. Find your AccidentTable that you created in the previous module. It should be close to the top of your list of tables, but you can also search for it by entering accident in the search bar at the top right.

  3. Select the table and then select Forms (from the Data experiences pane). Find and select the Main information form to navigate to the form design experience.

  4. Add the Owner to the Header section of the table by dragging the Owner field and then dropping it to the upper right of the header.

  5. Add the fields that a user will enter for new accident records in the General section of the form. Drag the fields and then drop them into the General section of your form. Put them in the following order:

    1. AccidentId

    2. LocationId

    3. AccidentTypeId

    4. AccidentDate

    5. AccidentDescription

  6. Set the AccidentId field to Read-only by selecting the AccidentId field, and on the right under Properties, select the checkbox next to Read-only.

  7. Select the LocationId field, and on the right under Properties, change the Default view (you might need to scroll down the properties to find it) from LocationTable Lookup View to Active LocationTables.

  8. Still in the LocationId properties, just under the Default view dropdown menu, select the checkbox next to Allow users to change view. Doing this causes the Show all views option to appear, go ahead and check this one, too. For this exercise we want both checkboxes selected so that our users can see the different form views and select the one they want.

  9. Repeat the previous steps for the AccidentTypeId field and then set the Default view to Active TypeofAccidentTables. Again select the options underneath to Allow users to change view and to Show all views.

  10. Select the Components section from the side navigation panel (it resembles four squares being arranged into a larger square) and then select the 1-column tab option to add a new tab in the General section. (Refer to the image below to assist you with subsequent steps, numbered in the image. The image shows the completed form.)

    Screenshot of the completed table.

  11. In the Properties pane, for the Label, enter Manager Review. For the Name, enter tab_2. Select the new Manager Review tab on the form.

  12. Switch from Components to Table columns and add the following fields to the new tab:

    • ManagerReviewed

    • ManagerComments

  13. On the form canvas, select the General tab.

  14. From the left navigation menu, select the Components section again, then select Subgrid. (If you don't see it, you can expand the list under Grid to find it.)

  15. In the Select subgrid views popup window, find EmployeeTables under Table and then select Active EmployeeTables as the Default view.

  16. Select Done to add the subgrid.

  17. Give the subgrid a more meaningful name. In the Label field under Properties, enter Involved Employees. Look for the Show related records checkbox and make sure that it's selected.

  18. Select Save and Publish to complete the form.

    Next, let's use our new form to add some data to our AccidentTable.

  19. Return to the Tables > AccidentTable main screen.

  20. Select Edit from the command bar to go to the editable table.

  21. Now select the down chevron just to the right of the + New row button in the command bar and once more New row using form to navigate to a new main form.

  22. The new form opens in a separate browser tab and should resemble the one that you customized in the previous steps. Now, enter a new accident record with the following details:

    • LocationId - Select enter to reveal the available choices, and select an available location ID.

      Note

      If you press the Enter key while you're on the dropdown menu, it will reveal the location names instead of their IDs.

    • AccidentTypeId - Enter to reveal available options and then select the available ID.

    • AccidentDate - [select today's date]

    • AccidentDescription - Enter Two employees fell because of wet floor in the main room.

  23. Select Save from the command bar.

  24. After the record saves, the Involved Employees subgrid should appear, where you can add the involved employees.

  25. Select Add Existing Employee from the subgrid header, then press Enter in the Look for records box to reveal the employee IDs. If you select each one, you'll see the record form for Oscar Ward and Serena Davis, respectively. Select both of these employee IDs.

  26. Select Add to add the employee names. (You might need to select Refresh for the names to show in the list.)

  27. Select Save & Close from the command bar to complete the process.

    Screenshot of a list of Involved Employees.

In this exercise, you saw how a subgrid enables you to enter related information from another table. You now understand that you can modify out-of-the-box forms to meet your organizational needs. Similar to modifying table views, you can get to the forms editor from the same table interface screen in Power Apps. Finally, you can test your form to practice data entry into your table. Great job! It's time for a knowledge check.