Skip to content

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: 

Comments

Comment: 

Hi,

I was able to add "address" field in the "customer lookup" page  by creating a table extension for customer and adding the "Address" field to the DropDown field group.

Now the "address" field is displayed last in the lookup.. How to move the "address" field next to "No." field?

Thanks

Comment: 

Hi  KaviJose,

This is not supported yet in AL and here is GitHub issue which Microsoft has not yet closed. https://github.com/Microsoft/AL/issues/4412

Thanks and regards,

Anupa

Comment: 

Thank you Anupa :)

Read ArcherPoint's Blog Follow us on Twitter Follow us on Facebook Follow us on LinkedIn Link to our RSS feed Watch us on YouTube
Get Help Now