Exercise - Create the Customer Rewards Mgt Setup table object
Scenario
The Customer Rewards Mgt Setup table is used for storing information about the codeunit that should be used to handle events in the extension, which will enable you to create mock events in your sample test.
The table consists of two fields:
Primary Key
Cust. Rew. Ext. Mgt. Cod. ID
Create the Customer Rewards Management Setup table object
Create a new .al file.
To create a new table in your extension, first create a new file by selecting the New File button in the side bar of Visual Studio Code.
Make sure that the file name ends with .al. In this example, you might want to use the name CustomerRewardsMgtSetup.Table.al.
Add the code to the table. You can copy the following code and paste it in the CustomerRewardsMgtSetup.Table.al file.
table 50102 "Customer Rewards Mgt Setup"
{
Caption = 'Customer Rewards Mgt. Setup';
DataClassification = CustomerContent;
fields
{
field(1; "Primary Key"; Code[10])
{
Caption = 'Primary Key';
DataClassification = CustomerContent;
}
field(2; "Cust. Rew. Ext. Mgt. Cod. ID"; Integer)
{
Caption = 'Customer Rewards Ext. Mgt. Codeunit ID';
DataClassification = CustomerContent;
//TableRelation = "CodeUnit Metadata".ID;
}
}
keys
{
key(PK; "Primary Key")
{
Clustered = true;
}
}
}
Because the object the TableRelation links to doesn't exist yet, the compiler will show an error on this line. To remove the error, temporarily, the TableRelation has been commented out.