Skip to main content

Notifications

Adding a field in an extension in Microsoft Dynamics Business Central or NAV

ArcherPoint Profile Picture ArcherPoint 12,385

How To: Add a Field in an Extension in Microsoft Dynamics Business Central/NAV 

How to Add a Field in an Extension in Microsoft Dynamics 365 Business Central or Dynamics NAV

This blog explains how to add a field in an extension in Microsoft Dynamics NAV or Business Central. The steps involved are:

  1. Creating a table extension
  2. Adding a field to the table
  3. Creating a page extension
  4. Placing the field on the page

Step 1: Create a Table Extension

  1. Select View ->Command palette ->AL:Go!
  2. In launch.json (Figure1), change the following requirements as needed (see example in Figure 2):
    Figure 1 - launch.json in Microsoft Dynamics Business Central/NAV
    Figure 1 - launch.json in Microsoft Dynamics Business Central/NAV
    Figure 2 - Modified launch.json in Microsoft Dynamics Business Central/NAV
    Figure 2 - Modified launch.json in Microsoft Dynamics Business Central/NAV
  3. You might get an error in Helloworld.al. Following is how to correct it:
     Figure 3 - HelloWorld .al in Microsoft Dynamics Business Central/NAV
     Figure 3 - HelloWorld .al in Microsoft Dynamics Business Central/NAV
    Figure 4 - Navigating through view menu in Microsoft Dynamics Business Central/NAV
    Figure 4 - Navigating through view menu in Microsoft Dynamics Business Central/NAVā€‹
  4. Download the symbols and make sure there are no errors in Helloworld.al.
    Figure 5 - Downloading the symbols in Microsoft Dynamics Business Central/NAV
    Figure 5 - Downloading the symbols in Microsoft Dynamics Business Central/NAV
  5. If the errors are cleared, delete the al file.
    Figure 6 - Error-free modified HelloWorld.al in Microsoft Dynamics Business Central/NAV
    Figure 6 - Error-free modified HelloWorld.al in Microsoft Dynamics Business Central/NAV
    Figure 7 - Deleting the HelloWorld.al in Microsoft Dynamics Business Central/NAV
    Figure 7 - Deleting the HelloWorld.al in Microsoft Dynamics Business Central/NAVā€‹
  6. Create a new file for the table extension.
    Figure 8 - Creating a new file for a table extension in Microsoft Dynamics Business Central/NAV
    Figure 8 - Creating a new file for a table extension in Microsoft Dynamics Business Central/NAV
  7. Create the table extension using ttable ext snippet. 
    Figure 9 - Creating a new table extension in Microsoft Dynamics Business Central/NAV
    Figure 9 - Creating a new table extension in Microsoft Dynamics Business Central/NAV
  8. Add the extension name, id, and table name to extend. Remove the selected area in the field for adding the table field.
    Figure 10 - Adding the table id and name in Microsoft Dynamics Business Central/NAV
    Figure 10 - Adding the table id and name in Microsoft Dynamics Business Central/NAV

Step 2: Add the Table Field

  1. Add a field to the table using the tfield snippet.
    Figure 11 - Creating new table field in Microsoft Dynamics Business Central/NAV
    Figure 11 - Creating new table field in Microsoft Dynamics Business Central/NAV
  2. Add the following details according to the requirement. Add the field id, field name, and data type.
    Figure 12 - Adding a field to a table in Microsoft Dynamics Business Central/NAV
    Figure 12 - Adding a field to a table in Microsoft Dynamics Business Central/NAV

Step 3: Create a Page Extension

  1. Create the page extension file.
  2. In it, create a new page extension using the snippet.
    Figure 13 - Page extension using snippet in Microsoft Dynamics Business Central/NAV
    Figure 13 - Page extension using snippet in Microsoft Dynamics Business Central/NAV
  3. Write the id, name of the extension, and table name.
    Figure 14 - Page extension of item card in Microsoft Dynamics Business Central/NAV
    Figure 14 - Page extension of item card in Microsoft Dynamics Business Central/NAV
  4. Design the layout portion (adding the code to where the field is needed).

Step 4: Place the Field in the Page

  1. Choose the location where the field is needed.
    Figure 15 - Selecting the field location in Microsoft Dynamics Business Central/NAV
    Figure 15 - Selecting the field location in Microsoft Dynamics Business Central/NAV
    Figure 16 - Adding the page field in Microsoft Dynamics Business Central/NAV
    Figure 16 - Adding the page field in Microsoft Dynamics Business Central/NAVā€‹
  2. In Figure 16, you will see that the field ItemStatus is needed after the item category code. After adding publish it using AL, publish or press F5.
    Figure 17 - Publishing an extension in Microsoft Dynamics Business Central/NAV
    Figure 17 - Publishing an extension in Microsoft Dynamics Business Central/NAV
  3. The output will look like Figure 17.
    Figure 18 - A field added in an extension in Microsoft Dynamics Business Central/NAV
    Figure 18 - A field added in an extension in Microsoft Dynamics Business Central/NAV

If you have any questions about Microsoft Dynamics NAV or Business Central functionality, contact ArcherPoint.

Read more "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics Business Central or NAV. If you are interested in NAV/Business Central development, check out our collection of NAV Development Blogs.

Blog Tags: 

This was originally posted here.

Comments

*This post is locked for comments