Thursday, 22 December 2016

Developing Extensions Using the New Visual Studio Code – Part 2


We finished step 1 of creating a sample extension using new visual studio code.

Let’s start with step 2 – adding “Reason Code for Lost Quote” in Standard Job table.

We need to extend the standard Job table here.

To recap again.

·        The table extension object allows us to add additional fields or to change some properties on a table provided by the Dynamics NAV service. In this way, we can add data to the same table and treat it as a single table.

Along with defining other fields, the table extension is where we write trigger code for our additional fields.

We need to create a table extension which is different from table which we have created yesterday.

That’s a new table and today we are extending the existing table.

Open the Visual studio code and Folder ReasonCodeforLostJobQuote which we created yesterday if it is not open.

Click on New File

Add name “JobTabExtReasonCodeforLostQuote.al”

Typing the shortcut ttableext will create the basic layout for a table extension object when using the AL Extension in Visual Studio Code.

Like

Edit ID to 70000001 and Name as “Job Reason Code for Lost Quote” and extends Job.

I guess it is because of missing app.json file so let’s create app.json file first.
We can create it manually or it will be created by building the solution (Ctrl+Shift+B).
Let me create it manually for now.

Create new file with name app.json and with parameters in below screenshot.

Setting
Mandatory
Value
id
Yes
The unique ID of the extension. When app.json file is automatically created, the ID is set to a new GUID value.
name
Yes
The unique extension name.
publisher
Yes
The name of your publisher, for example: NAV PartnerLLC
application
Yes, if base application objects are extended or referenced
The minimal supported version and locale of the base application to extend, for example: { "version": "10.0.0.0", "locale": "W1" }
platform
Yes, if system tables are referenced in the extension
The minimal supported version of the platform symbol package file, for example: "10.0.0.0". See the List of objects in the platform symbol file section below for the list of object symbols contained in the platform symbol package file.
packageCachePath
Yes, if base application is extended or system tables are referenced
The path to the folder where referenced symbol package files are located. The path could either be absolute or relative to the current extension working directory, for example: "../../resources"

Now build the solution by pressing Ctrl+Shift+B.

Now the package is created (Mohana_Reason Code for Lost Job Quote_1.0.0.0.navx)
Close the visual studio code and reopen again
Now the error is gone.

Add the field in al object with table relation to table 70000000 which we created yesterday.
This is how to create new field in existing table using new Visual Studio Code.

We will see how to add new page for created table 7000000 in in next blog.
Stay tuned.

1 comment:

  1. We have installed Visual studio code on our pc. The intellicence is not active.
    Please suggest what we must do. thanks.

    ReplyDelete