Pages in Microsoft Dynamics BC AL Extension - Muhammad-Ali-Mughal/Microsoft-Dynamics-BC-AL-Extension GitHub Wiki
Introduction to Pages in Microsoft Dynamics BC AL
Pages are the whole UI component you see in Microsoft Dynamics. These may contain input fields, lines, buttons, actions etc. Pages are of different types. Some pages cover the maximum area of your screen, and some are a part of page like the lines you see in a page is itself a separate page.
In Dynamics Business Central environment, Microsoft has already defined behaviors of pages according to their properties. This move of Microsoft has made a lot of things easier because developers can focus more on functionality rather than UI complexities.
Types of Pages in BC
Following are the major types of pages in BC:
- List Page (Contains the list of all records of a table, records may be filtered or not.)
- Card Page (Displays all the details of a single record in fields, this page can also contain List/Card parts in it.)
- List Part (This is a part of a Card page/Document page and display lines of corresponding record.)
- Card Part (This is also a part of a Document page and display fields of corresponding record from other tables.)
Syntax
page 50100 "Cronus Course List Page"
{
PageType = List;
ApplicationArea = All;
UsageCategory = Lists;
SourceTable = "CRONUS Course";
CardPageId = "Cronus Course Card Page";
layout
{
area(Content)
{
repeater(Hello)
{
field("Customer No."; Rec."Customer No.")
{
ApplicationArea = All;
}
field(Name; Rec.Name)
{
ApplicationArea = All;
}
}
}
area(Factboxes)
{
part(List_page_factbox; "Cronus Course CardPart")
{
Caption = 'List Page Fact Box';
ApplicationArea = All;
}
}
}
}
Properties
Let's have a look on some important properties of Page object in AL BC.
PageType
This property defines which type of the Page object is and it also defines its UI formation. This may be List, Card, ListPart, and CardPart.
ApplicationArea
This property defines the area which will the page cover.
UsageCategory
This defines where it will be listed and organized in the software when it is searched.
SourceTable
This defines the name of the table which will be majorly used as data source of the page.
CardPageId
In case of List page this property is defined because this specifies the system which page is to open when a record is selected and opened to show details. This is because list page only shows all the records with some fields of each record. This property creates a link between list part and its corresponding card page.
Editable
This property requires true and false statement which defines where the page is editable or not.
InsertAllowed
This is also a boolean type property and defines whether a new record can be inserted in a table or not.
DeleteAllowed
This is also a boolean type property and defines whether a new record can be deleted in a table or not.
How to Define Parts in a Page
Parts are usually defined in card page rather than list pages. ListPart and CardPart are defined inside area of the layout. These can be defined in any area (Content/Factboxes). Syntax of defining these is below:
page 50101 "Cronus Course Card Page"
{
PageType = Card;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = "CRONUS Course";
layout
{
area(Content)
{
group("My Group Name")
{
Caption = 'Group';
field(Code; Rec.Code)
{
ApplicationArea = All;
}
field(Name; Rec.Name)
{
ApplicationArea = All;
}
field(Email; Rec.Email)
{
ApplicationArea = All;
}
field("Post Code"; Rec."Post Code")
{
ApplicationArea = All;
Importance = Additional;
}
part(Content_Listpart; "Cronus Course ListPart")
{
Caption = 'ListPart';
ApplicationArea = All;
}
}
area(FactBoxes)
{
part(Factbox_cardpart; "Cronus Course CardPart")
{
Caption = 'Code';
ApplicationArea = All;
}
part(Factbox2_cardpart; "Cronus Course CardPart")
{
Caption = 'Fact Box 2';
ApplicationArea = All;
}
}
}
}