How To: Add a Field in an Extension in Microsoft Dynamics Business Central/NAV
Image may be NSFW.
Clik here to view.
This blog explains how to add a field in an extension in Microsoft Dynamics NAV or Business Central. The steps involved are:
- Creating a table extension
- Adding a field to the table
- Creating a page extension
- Placing the field on the page
Step 1: Create a Table Extension
- Select View ->Command palette ->AL:Go!
- In launch.json (Figure1), change the following requirements as needed (see example in Figure 2):
Image may be NSFW.
Clik here to view.
Figure 1 - launch.json in Microsoft Dynamics Business Central/NAV
Image may be NSFW.
Clik here to view.
Figure 2 - Modified launch.json in Microsoft Dynamics Business Central/NAV - You might get an error in Helloworld.al. Following is how to correct it:
Image may be NSFW.
Clik here to view.
Figure 3 - HelloWorld .al in Microsoft Dynamics Business Central/NAV
Image may be NSFW.
Clik here to view.
Figure 4 - Navigating through view menu in Microsoft Dynamics Business Central/NAV - Download the symbols and make sure there are no errors in Helloworld.al.
Image may be NSFW.
Clik here to view.
Figure 5 - Downloading the symbols in Microsoft Dynamics Business Central/NAV - If the errors are cleared, delete the al file.
Image may be NSFW.
Clik here to view.
Figure 6 - Error-free modified HelloWorld.al in Microsoft Dynamics Business Central/NAV
Image may be NSFW.
Clik here to view.
Figure 7 - Deleting the HelloWorld.al in Microsoft Dynamics Business Central/NAV - Create a new file for the table extension.
Image may be NSFW.
Clik here to view.
Figure 8 - Creating a new file for a table extension in Microsoft Dynamics Business Central/NAV - Create the table extension using ttable ext snippet.
Image may be NSFW.
Clik here to view.
Figure 9 - Creating a new table extension in Microsoft Dynamics Business Central/NAV - Add the extension name, id, and table name to extend. Remove the selected area in the field for adding the table field.
Image may be NSFW.
Clik here to view.
Figure 10 - Adding the table id and name in Microsoft Dynamics Business Central/NAV
Step 2: Add the Table Field
- Add a field to the table using the tfield snippet.
Image may be NSFW.
Clik here to view.
Figure 11 - Creating new table field in Microsoft Dynamics Business Central/NAV - Add the following details according to the requirement. Add the field id, field name, and data type.
Image may be NSFW.
Clik here to view.
Figure 12 - Adding a field to a table in Microsoft Dynamics Business Central/NAV
Step 3: Create a Page Extension
- Create the page extension file.
- In it, create a new page extension using the snippet.
Image may be NSFW.
Clik here to view.
Figure 13 - Page extension using snippet in Microsoft Dynamics Business Central/NAV - Write the id, name of the extension, and table name.
Image may be NSFW.
Clik here to view.
Figure 14 - Page extension of item card in Microsoft Dynamics Business Central/NAV - Design the layout portion (adding the code to where the field is needed).
Step 4: Place the Field in the Page
- Choose the location where the field is needed.
Image may be NSFW.
Clik here to view.
Figure 15 - Selecting the field location in Microsoft Dynamics Business Central/NAV
Image may be NSFW.
Clik here to view.
Figure 16 - Adding the page field in Microsoft Dynamics Business Central/NAV - 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.
Image may be NSFW.
Clik here to view.
Figure 17 - Publishing an extension in Microsoft Dynamics Business Central/NAV - The output will look like Figure 17.
Image may be NSFW.
Clik here to view.
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.