Steps to create Table Extension Object and Page Extension Object Using Visual Studio Code in NAV - CloudFronts

Steps to create Table Extension Object and Page Extension Object Using Visual Studio Code in NAV

Posted On January 5, 2017 by Posted in 

Introduction:

Table Extension and Page Extension are two new objects introduced in the Microsoft Dynamics NAV TENERIFE Developer Preview (Visual Studio Code) release. Table Extension allows to add more fields to an existing table and to change properties of certain fields of a table. Page Extension object allows to add additional fields and actions to an existing page and extends Dynamics NAV page object.

This article will provide the basic steps to create a Table extension object and Page extension object using Visual Studio Code in NAV.

Prerequisite:

1. Visual Studio Code
2. Microsoft Dynamics NAV TENERIFE (Developer Preview)

Purpose:

To create a table extension object and page extension object using Visual Studio Code in NAV. To demonstrate this, I will be adding an additional field on Item card.

Steps:

  1. Create a new folder for a new project.
  2. Fig 1: New Folder created for the Project
  3. Open this folder in Visual Studio Code
  4. Create a new file within this folder in Visual Studio Code
  5. Fig 2: Create a new file in the newly created folder
  6. Let’s name this file ‘ItemTableExt.al’
  7. Typing the shortcut ‘ttableext’ will create the basic layout for a table extension.

    Fig 3: Shortcut ttableext

    Fig 4: Basic layout of a table extension

    Replace ‘id’ with a unique table id. It should be in the range from ‘70000000’ to ‘74999999’. Replace ‘MyExtension’ with a unique name of the table extension and ‘MyTargetTable’ with the name of the table where these additional fields have to be added.

    This is shown in the below Screenshot.

    After entering the ‘MyTargetTable’ name, Press ‘Ctrl+Shift+B’ to build the solution which will create app.json file.

  8. Here, I will be creating a Decimal Field ‘Control Sample Qty’. To create a table field, type the shortcut ‘tfield’.
  9. Fig 5: Basic layout of a table field
  10. Replace ‘id’ with a unique field id. Replace ‘MyField’ with a unique field name and mention the type of the field viz. Decimal, Integer, etc. Mention the properties of the field below.

    Fig 6: New field ‘Control Sample Qty’ with ID ‘70000000’ of type ‘Decimal’ is added to ‘Item table’ which is highlighted in red colour. Property of this field i.e. ‘Editable=False’ is highlighted in lime colour.

    Hence the table extension has been created.

  11. To create a page extension, create a new file. Let’s name this file as ItemPageExt.al.
  12. Type the shortcut ‘tpageext’ to create a basic layout of a page extension.

    Fig 7: Basic layout of a page extension.

    In the layout section, you can use the following functions to place page fields and groups on the page. Similarly, in the actions section, you use these functions to place actions in the ribbon. (Note: General and AddressDetails are group names)

    1. addfirst(General) – Applies to Groups only
    2. addlast(General) – Applies to Groups only
    3. addafter(AddressDetails) – Applies to Fields and groups
    4. addbefore(AddressDetails) – Applies to Fields and groups
    5. movefirst(General) – Applies to Groups only
    6. movelast(General) – Applies to Groups only
    7. moveafter(AddressDetails) – Applies to Fields and groups
    8. movebefore(AddressDetails) – Applies to Fields and groups
  13. Replace id with a unique page extension id in the range from ‘70000000’ to ‘74999999’. Replace ‘MyExtension’ with the name of the page extension. Replace ‘MyTargetPage’ with the name of the existing page in which additional functionality has to be added.
  14. The following page extension extends Item card and adds field ‘Control Sample Qty’ to the ‘InventoryGrp’.

    Fig 8: Field is added to the page using Page extension

    Hence, page extension is created.

  15. Build the solution using ‘Ctrl+Shift+B’.

    Hence ‘navx file’ will be created.

  16. Press F5 to create launch.json file or manually create launch.json file. Thus launch.json will be created.

    Fig: launch.json
  17. In the NAV Web client, in Extensions Management, the published extension will be displayed.

    Fig 9: Extensions Management

    Thus, the newly created field i.e. ‘Control Sample Qty’ will be displayed in Item card.

    Fig 10: New field ‘Control Sample Qty’ field has been added to Item card.

    Conclusion:

    Thus, Table extension is used when additional fields are to be added to an existing table or any properties of the fields have to be changed and Page extension is used to add additional functionality to existing pages like extra fields and actions.

     


Share Story :

Secured By miniOrange