5 Jan’17

D365 Business CentralSteps to create Table Extension Object and Page Extension Object Using Visual Studio Code in NAV

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.

     

    Written by

    Team Member

    CloudFronts

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Introduction to Microsoft Dynamics Commerce Tools

    19 October’ 2019

    As we know, Dynamics 365 Commerce is released in the preview version, So in this blog, we will have a quick explanation ...

    Read more
  • Error Handling Approaches for Integration

    16 October’ 2019

    Introduction: Handling Errors is a best practice in Integration when integrating to keep a track of the Errors that occu...

    Read more
  • Change in URLs for Business Central Tenants

    16 October’ 2019

    Change in base URLs for Business Central SaaS Tenants. I have noticed the Business Central links for Tenants have chan...

    Read more
  • Record Deletion Tool in Business Central

    16 October’ 2019

    Introduction: After a successful Go-Live in Business Central, we somehow need to delete a record from Backend. There is...

    Read more
  • Error “A reference to ‘xyz ‘ is required to compile this module” solution

    10 October’ 2019

    Many of the time while building project/solution we came across the “reference is required to compile this module ...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.