microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
733 stars 243 forks source link

To create a new fact box in a Page in NAV using VS Code #50

Closed Chris-Dsilva closed 7 years ago

Chris-Dsilva commented 7 years ago

Hi

What is the syntax to create a new fact box as as extension to a page in NAV using VS code

esbenk commented 7 years ago

Small code sample below. The first half is the definition of a new Part, the second half adds the new part to an existing page (in the sample to the Customer Card).

// The factbox part that should be added
page 70040000 MyOwnFactBox
{
    PageType = CardPart;
    SourceTable = Item;

    layout
    {
        area(Content)
        {
            field(Desc;Description) {}
        }
    }
}

// Page extension adding "MyOwnFactBox" to the Customer Card
pageextension 70004001 MyExtension extends "Customer Card"
{
    layout
    {
        // Add changes to page layout here
        addfirst(FactBoxes)
        {
            part(MyFactBox;MyOwnFactBox)
            {

            }
        }
    }

    actions
    {
        // Add changes to page actions here
    }
}
esbenk commented 7 years ago

MyFactBox is the name of the part on the MyExtension page. All controls/parts are required to be named in the new syntax.