Creating a new table and a list page is a straightforward task in Business Central development.
Let’s walk through a simple scenario where we:
- Create a new table
- Create a list page
- Attach the list page to the Order Processor Role Center
Steps to Create a New Table and List Page
Step 1: Create the Table
- Open your development environment (e.g., Visual Studio Code).
- Define a new AL file for the table and write the table definition, including fields, primary key, and any necessary properties.
- Save and publish the table.
Step 2: Create the List Page
- Create a new AL file for the page.
- Use the
PageType
property set to List. - Link the page to the table you created in Step 1 by specifying the
SourceTable
property. - Add fields and layout as required to display the data.
Step 3: Attach the List Page to the Role Center
Identify the Role Center (Order Processor) in the application.
Modify the Role Center to include your newly created list page, either by adding it as an action or a part.
// New Table
table 50110 "Customer Classification"
{
DataClassification = ToBeClassified;
fields
{
field(10; "Code"; Code[20])
{
DataClassification = ToBeClassified;
}
field(20; Description; text[100])
{
}
}
keys
{
key(Key1; Code)
{
Clustered = true;
}
}
}
// New Page
page 50110 "Customer Classification"
{
PageType = List;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = "Customer Classification";
layout
{
area(Content)
{
repeater(General)
{
field(Code; rec.Code)
{
}
field(Description; Rec.Description)
{
}
}
}
}
}
//Attach to Role Center
pageextension 50111 OrderProcessExt extends 9006
{
actions
{
addafter(Action61)
{
action(CustomerClassification)
{
ApplicationArea = Basic, Suite;
Caption = 'Customer Classification';
Image = Customer;
RunObject = Page "Customer Classification";
ToolTip = 'View or edit detailed information for the customers that you trade with. From each customer card, you can open related information, such as sales statistics and ongoing orders, and you can define special prices and line discounts that you grant if certain conditions are met.';
}
}
}
}
Subscribe! so you wont miss latest posts...