How to do it...

  1. Open your AL project folder in Visual Studio Code.
  2. In Visual Studio Code's Explorer pane, right-click and create a new file named Customer Card Extension.al. In the Editor tab, add the following code, which does two things:
    • It adds the Television Viewing Country field as the final field in the General section.
    • It adds a new action button at the end of the Navigation group to show the television shows for the given customer:
pageextension 50100 CustomerCardExtension extends "Customer Card"
{
layout
{
addlast(General)
{
field("Television Viewing Country";
"Television Viewing Country")
{
ApplicationArea = All;
}
}
}

actions
{
addlast(Navigation)
{
action("Customer Television Shows")
{
ApplicationArea = All;
Image = ListPage;
RunObject = Page "Customer Television
Shows";
RunPageLink = "Customer No." = field
("No.");
}
}
}
}
Use the tpageext snippet to create a page extension object. You can also use the tpagefield and taction snippets to create new fields and actions.
  1. Now, it's time to test our new additions. Press F5 to build and publish your application. When your browser opens and you log in to your sandbox, perform the following steps:
    1. Use the  icon and search for customers to go on the Customer List.
    2. Select any customer to drill into the customer card.

First, let's look for the new field that we added. Do you remember where we added it? You should be able to see it on the General tab:

Next, let's check the new action we added. On the customer card, select Navigate | Customer Television Shows. You may need to first select More options to see the Navigate link. This will open the Customer Television Shows page:

I told you it was easy!

Each Business Central application can contain only one page extension object per page. However, a page can be extended by multiple applications.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.27.251