› Dynamics NAV › ‘Item Classification’ in NAV using Visual Studio Code (VS Code)

‘Item Classification’ in NAV using Visual Studio Code (VS Code)

 Chris D'silva   Leave a comment

In this article, we create an extension of standard Page ‘Item Card’ in NAV using Visual studio code (VS Code). To implement the extension, I have created a field ‘Item Classification’ whose Data type is an Option in the table extension in Visual Studio Code. We use app.json (Cltl+shift+B) to build and create a .navx package and launch.json(F5) to publish the extension on the NAV Web Client.

Business Requirement

Item classification field classifies the raw materials whether it is an Active Pharmaceutical Ingredient(API), Excipient, Pallet, Capsules, Finished Good and Ingredient. This is used by the Production Department to issue Raw Materials from the Warehouse. They classify the items they need by using the Item classification field.

Prerequisites:

1. Visual Studio Code
2. Microsoft Dynamics Web Client.

Steps:

  1. We Create a folder named ‘Item Extension’ in which we place all are codes. Open the visual studio code, click on Explorer and then click on ‘Open folder’. Click on new file and rename it with a name with extension .al e.g ItemTabExt.al
  2. Now we create a table extension of standard table ‘Item’. Typing the shortcut ‘ttableext’ creates a basic layout for the table extension object. We provide an id and extends the table name in this case it is the Item The table id range is from 70000000 to 74999999.

    While saving, it throws error like ‘The target page Item for the extension is not found’ for this we need to create the app.son file by building the solution (Cltl+Shift+B).

    app.json is automictically created with a 16 byte binary data type which is a GUID.

    Enter the extension name and publisher for the same.

    Below is the app.json file

    The package Cache path is the path to the folder where referenced symbol package files are located. The path could be absolute or relative to the current extension working directory.

    Now here the package is created Chris_Item extension_1.0.0.0.navx

    This removed the error on extension table name.

  3. Typing the shortcut ‘tfield’ creates the basic layout for the fields. Enter the field id, name and data type in this case the field name is ‘Item Classification’ and data type is ‘Option’.
    We enter the Caption and the Option string for it.

  4. To create the page extension, we type the shortcut tpageext which will create the basic layout for page object using AL extension in Visual Studio code. Edit the id and name and extends Page Name in this case it is ‘Item Card’. We use the function name addlast(Group Name) to add the field at the last of the Group Name Specified.typing the ‘tfieldpage’ automatically creates the layout, we edit MyField and write the field name , edit the source and write the Caption for it.
  5. Publishing the extension(F5) will generate the launch.json file
  6. Open the Web client and in the search bar type ‘Extension Management’.

    Click on the installed app. It gives you the details of the Extension name,version and Publisher name.

  7. Browse to the Item Page, the field ‘Item classification’ is added.

Conclusion:

We created table and Page extensions using visual Studio for Standard Table 27 Item and Page 30 Item Card.

 


Liked it? Share it.

Leave a Reply

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

Time limit is exhausted. Please reload the CAPTCHA.