Thursday 22 December 2016

Developing Extensions Using the New Visual Studio Code – Part 4


We finished step 1, step2 and step3 of creating a sample extension using new visual studio code.

Let’s start with step 4 – adding a field to existing page like "Reason Code for Lost Quote" to Job Card page.

We need to create new page extension object using visual studio code.

The page extension object extends a Dynamics NAV page object and adds or overrides the functionality.

The structure of a page is hierarchical and breaks down in to three sections. The first block contains metadata for the overall page; the type of the page and the source table it is showing data from. The next section; the layout, describes the visual parts on the page. The final section details the actions that are published on the page.

In the layout section, you can use the following functions to place page fields and groups on the page. Similarly, in the actions section, you use these functions to place actions in the ribbon.

Function example
Applies to...
addfirst(General)
Groups only
addlast(General)
Groups only
addafter(AddressDetails; "Post Code")
Fields and groups
addbefore(AddressDetails; "Post Code")
Fields and groups
movefirst(General)
Groups only
movelast(General)
Groups only
moveafter(AddressDetails; "Post Code")
Fields and groups
movebefore(AddressDetails; "Post Code")
Fields and groups

If you want to modify existing fields and groups on a page, you use the modify() function.
Open the Visual studio code and Folder ReasonCodeforLostJobQuote which we created before if it is not open.



Click on New File
Add name “JobcardpageExtReasonCodeforLostQuote.al”

Typing the shortcut tpageext will create the basic layout for a table object when using the AL Extension in Visual Studio Code.
Like
Edit ID to 70000001 and Name as “Reason Code for Lost Quote” and extends “Job Card”.

Add field "Reason Code for Lost Quote" to General tab as shown below


This is how field is added to existing page using page extension in Visual studio code.

We will see how to Build final package and install extension in next blog.

Stay tuned.


No comments:

Post a Comment