Exercise - Create the Customer table extension object

Completed

Scenario

The Customer table, like many other tables, is part of the Business Central service and it can't be directly modified by developers. To add more fields or to change properties on this table, developers must create a new type of object: a table extension.

For your customer rewards extension, you want to add a field to the Customer table. In the following steps, you'll create a table extension for the Customer table and add the RewardPoints field.

Create the Customer table extension object

To create the Customer table extension object, follow these steps:

  1. Create a new .al file.

    1. To create a new page in your extension, first create a new file by selecting the New File button in the side bar of Visual Studio Code.

    2. Make sure that the filename ends with .al. In this example, you might want to use the name Customer.TableExt.al.

  2. Add the code to the page. You can copy the following code and paste it in the Customer.TableExt.al file.

      tableextension 50100 Customer extends Customer
     {
       fields
       {
         field(10001; RewardPoints; Integer)
         {
           Caption = 'Reward Points';
           DataClassification = CustomerContent;
           MinValue = 0;
         }
       }
     }