Skip to main content

MSDYN365BC - AL Development 04 - How to Customize Base Pages?

Hi Readers,

I am optimistic that everyone was able to follow what we discussed till now. If you haven't read the earlier article, then
Refer to the Table of Content.

So in this article, we will add fields added in tables in the pages so that user can access those fields.

The customer Requires new fields added in few standard pages.
In this article, we will learn a new object type in Business Central i.e Page Extension.

Page Extension is a new object type using which we can add fields, actions, and functions in the base pages without modifying Microsoft Base Objects.

Currently, let's add a new field in pages -

  • Sales Order.
  • Posted Sales Shipment.
  • Posted Sales Invoice.

Add a New file on the Left-hand Panel - Right click and select New File as shown below.
As per our standard Page Extension file Name is -

Snippet for adding a new page extension, use snippet tpageext as shown below.

Next step is to set the following properties (as shown below) - 

ID - Object ID.
MyExtension - Extended Page Name.
MyTargetPage - Extending Base Page Name.

Let's understand why and what we set.

ID - Object ID for the new object created.
MyExtension - Unique Page Extension Object Name.
MyTargetPage - Name of the Microsoft base page name which we are extending or customizing.

By Default Page Extension Provide three sections -

  1. Layout - To Add New Fields in the page.
  2. Action - To Add New actions on the page.
  3. Global Variables.

But You can also add additional sections (if required) like -
- Triggers.
- Function.

Triggers for are the page is below -

  • OnAfterGetCurrRecord.
  • OnAfterGetRecord.
  • OnClosePage.
  • OnDeleteRecord.
  • OnInsertRecord.
  • OnModifyRecord.
  • OnNewRecord.
  • OnOpenPage.
  • OnQueryClosePage.

So after all these let's add the field that we want to add in this Sales Order Page using Page Extension.

Remember - 
1. All Fields in the page are added in Layout Area.
2. Adding a field in Page using Page Extension will be a bit different than adding a field in a table using table Extension.

As we want to add a field in Page (Sales order page), we need to tell the system where we want to add the field. There are 04 options that we can choose from while adding a field in the page. Let's understand why and what are those options.

Above is a screenshot of the Sales order Page. Now while adding a field in this page, we need to specify under which section and at what position we want to add the field.

AL Provide us 04 options to specify the position of a new field that we are adding and those options are -

  • AddFirst    - Add as first control in a tab.
  • AddLast     - Add as last control in a tab.
  • AddBefore - Add field before a standard field in the page.
  • AddAfter   - Add field after a standard field in the page.
For AddFirst & AddLast, we need to specify the anchor Group Name and for AddBefore & AddAfter, we need to specify anchor field Name.

What is Anchor? - The name of the control serving as an anchor for placing the new control.

Let's assume I want to add my field after External Document No. then -

  • We can use Addafter with an anchor External Document No.
  • For adding a field in the page you can use tpagefield snippet.
  • Specify the Field Name and Source Expression in the field.
  • For the Field, we can also add properties. As we discussed earlier there is a mandatory property for user-visible items like fields i.e ApplicationArea. 
  • If you want to have to see the field in every case then you remember NAV Page Field Property Importance. 

With this, the Page Extension is ready for Sales Order. In the same way, you can complete all other page extensions as shown below.

Sales Order Extension  -

Posted Sales Invoice Extension -

Posted Sales Shipment Extension -

Stay Tuned for more. I hope you learned something today.

We will discuss more in the next article. Please provide feedback as comments to the article.

To share the knowledge share the article on social media.

Saurav Dhyani


  1. Detailed explanation is required for Importance property, then it is more understandable.

    1. Hope this helps.

  2. Excellent article. Very useful and very informative. Great Job Saurav. Thanks Spriya.


Post a Comment

Popular posts from this blog

Welcome - Microsoft Dynamics 365!

Hi All, In this article we will discuss the new introduced member of Dynamics Family. Yes you heard it correctly, one more new member with Name "Microsoft Dynamics 365" . #ProjectMadeira   #Dynamics365

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing - 

NAV 2013 Credential Type - How to Use?

Hi all, Please do these activities when you have time, its a long activity and i would suggest do all activities in one go. So be clam and lets start. For NAV 2013 R2 Refer Here. For NAV 2016 Steps have been Reduced Please Refer Here. I have installed NAV 2013 and its work great with my windows credentials. I was checking the service console (Microsoft Dynamics NAV Administration) in NAV 2013 and found out that Credentials Type have multiple Options.