Table of Contents
Add or show new field in existing Page in D365:
Step-01:
- The page extension object extends a Dynamics 365 Business Central page object and adds or overrides the functionality.
- The structure of a page is hierarchical and breaks down into three sections. The first block contains metadata for the overall page; the type of the page and the source table it is showing data from. The next section; the layout, describes the visual parts on the page. The final section details the actions that are published on the page.
- Mandatory – Only pages with the Extensible Property set to true can be extended.
Step-02:
- Open Visual Studio Code and Select “.vscode” and Add New File as shown in image.
Step-03:
- Enter the name of the extension as shown in image.
Step-04:
In the following example, we use a table extension to extend the Sales Header table with a new field named LDClause of the data type Boolean. Then we create a page extension object that extends the Sales Order page object by adding a field control LDClause
to the General
group after the Posting Date field on the page.
pageextension 50002 CustomerCardExtension extends “Sales Order” { layout { // Adding a new control field ‘LDClause’ in the group ‘General’ after “Posting Date” field. addAfter(“Posting Date”) { field(“LDClause”; LDClause) { Caption = ‘LD Clause’; trigger OnValidate(); begin if LDClause = True then Error('Validate the Code'); end; } } } |