Exercise - Create custom tables and columns

Completed

In this exercise, you create a new custom table named Machine Order, and you add columns that are necessary for tracking the machine requests. You also create a server-side business rule that defaults the estimated ship date.

Note

To complete the exercises, you'll need to use a few files. Download the App in a Day files for use in this module. The file folders that are in this download include:

  • Completed modules with instructions - Package files to import the completed exercise steps.
  • Machine-Order-Data.xlsx - File used in the exercises.

Section 1: Create a custom table

In this task, you create a custom table to store machine order requests.

  1. Select Solutions and then open the Contoso Coffee solution.

  2. Select the + New drop down from the tool bar at the top of the page, hover over the Table option and then choose Table.

    Screenshot showing the create new button and the Table option.

  3. Enter Machine Order in the Display name field. The Plural name field automatically populates based on your entry in the Display name field. These fields are editable if you need to make changes. The system uses the plural name by default whenever a set of rows are shown.

    Select the Enable attachments option because it allows you to create notes on the machine order.

    Screenshot showing the New table dialog, with the Display name and Plural name fields filled in.

  4. Select the Primary column tab.

  5. Change the Display name field to Machine Name. The Primary column defaults to being named Name. For some scenarios, that label might not be the best one, so you can customize it if needed. However, the Primary column is always a text column that isn't changeable.

  6. Select Save.

    Screenshot of the Primary column tab, showing the Display name field changed to Machine Name.

Section 2: Create custom columns

In this task, you create custom columns for the Machine Order table. It might take a few minutes for your new Machine Order table to provision. Begin these steps after it finishes.

  1. Within the Objects pane to the left of the screen, select to open the Machine Order table that you created.

  2. Select the + New drop down and then choose Column.

    Screenshot of the add New button and the Column option highlighted.

  3. Enter Price in the Display name field, enter Machine Price in the Description box, and then select Currency from the Data type dropdown menu. From the Required dropdown menu, make the column Business Required. Select the Searchable option and then select Advanced options.

    Note

    Currency is a special data type that allows you to build multi-currency solutions. For each currency column that you add, another currency column will be added with the prefix _Base on the name. This column stores the calculation of the value of the currency column that you added and the base currency. For more information, see Using currency fields.

    Screenshot showing the Advanced options button in the New column dialog.

  4. Enter 0 in the Minimum value field, enter 50000 in the Maximum value field, and then select Save.

    Screenshot showing the Minimum value and Maximum value fields filled in.

  5. Select the + New drop down, and then choose Column again.

  6. Enter Requested By in the Display name field, select Single line of text from the Data type dropdown menu, choose Email from the Format dropdown menu, ensure that the column is Searchable, and then select Save.

    Screenshot of the Requested By form with the correct data entered in the fields.

  7. Repeat the Add column process and add the following columns:

    Display name Data type Format
    Request Date Date and time Date only
    Approver Single line of text Email
    Comments Multiple lines of text Text
    Estimated Ship Date Date and time Date only
    Approved Date Date and time Date only
  8. Now, you create the Approval Choice. You're adding it as a choice (as opposed to a two-option) because users likely have more than Yes/No options to choose from. Select the + New drop down and then choose Column.

  9. Enter Approval Status in the Display name field, select Choice from the Data type dropdown menu, choose No beneath the Sync with global choice section, enter Approve in the Label field, and then select + New choice.

    Screenshot showing the new choice button and No selected for the Sync with global choice option.

  10. Enter Reject in the Label field and then select Save.

    Screenshot showing options in the Choices section.

Section 3: Create a formula column

In this task, you add a Department Contribution column using the formula data type and set its value to 10 percent of the price. In this scenario, this amount comes from the department manager's budget. In Dataverse, the "Formula" column refers to a column where the values are calculated based on a formula defined by the user. This formula can be created using a syntax specific to Dataverse, often similar to Excel formulas.

  1. Select the + New drop down from the top of the page and then choose Column.

  2. Enter Department Contribution in the Display name field, select Formula from the Data type dropdown menu.

  3. In the formula box, enter the formula Decimal(Price)*.1

    Screenshot showing the calculated column behavior selection.

Section 4: Create a business rule

In this task, you'll create a business rule that sets the Estimated Delivery Date to 14 days after the order is approved.

  1. Select the + New drop down located at the top of the page and then choose Business rule.

    Screenshot showing the add New button and the Business rule option highlighted.

  2. Select the drop-down arrow to Show Details.

    Screenshot highlighting the arrow that will show details.

  3. Change the Business rule name to Calculate Ship Date. You can add a description as well like Set the ship date to 14 days. Then select the arrow to Hide Details.

    Screenshot of Calculate Ship Date entered in the Business rule name field.

  4. Select the Condition, and then change the Display name to Check Approved Date.

    Screenshot of the condition selected and the Display Named field changed to Check Approved Date.

  5. In the Rules section, select Entity from the Source dropdown menu, choose Approved Date from the Field dropdown menu, select Contains data from the Operator dropdown menu, and then choose Apply.

    Note

    You might need to scroll down to the bottom of all scroll bars for the Apply button. Make sure that you select Apply after any change to the properties; otherwise, they will revert to the prior value. The Business Rule (Text View) will automatically update after you select Apply when you're done modifying the rule.

    Screenshot of the Properties pane, showing the fields filled in.

  6. Select + Add from the tool bar at the top of the page and then choose Add Set Field Value.

    Screenshot of the Add Set Field Value option selected from the Add dropdown menu.

  7. Select the true side of the condition.

    Screenshot with a box around the true side of the condition.

  8. Enter the following information in the Set Field Value Properties pane:

    • Display name: Set Estimated Ship Date
    • Field: Estimated Ship Date
    • Type: Formula
    • Second Field: Approved Date
    • Operator: plus (+) sign
    • Second Type: Value
    • Days: 14

    Select Apply when you're finished.

    Screenshot showing the Properties pane of the Set Field Value, showing information filled in.

  9. From the top right hand corner of the page, select Validate.

    Screenshot showing the Validate button.

  10. Make sure that the validation succeeds.

    Screenshot of the message stating that validation was successful.

  11. Select Save.

    Screenshot showing the Save button.

  12. Select Activate.

    Screenshot showing the Activate button.

  13. Confirm activation. Business rules only run when they're activated. In the future, to make changes to rules, you need to deactivate them, make the change, and then reactivate the rule.

    Screenshot shwoing Activate button to process the activate confirmation.

  14. Close the process editor browser window or tab.

  15. Select Done. The list should refresh and show the business rule that you created.

    Screenshot with a box around the Done button.

Important

Don't navigate away from this page.