NAV 2017 – Delivering custom code as extension

Standard

We can still deliver our custom code as a fob in NAV 2017 as most VARs will continue to do so in the foreseeable future, however it seems to me that ISVs will embrace faster the new method. While in my first blog on extensions I was focused on explaining the basics of the technical side of creating an extension, in this blog I will delve into delivering a functional requirement as an extension.

I will go through an exercise of adding a new field: “Created By” Code 20 (a valid user from User table)  to Sales documents.

If you’re planning to follow this exercise please review “Setting up your working space” from my previous blog.

I will make this new field available on:

  • Table 36 “Sales Header”
  • Table 112 “Sales Invoice Header”
  • Table 114 “Sales Cr. Memo Header”
  • Page 43 “Sales Invoices”
  • Page 44 “Sales Credit Memo”
  • Page 132 “Posted Sales Invoices”
  • Page 134 “Posted Sales Credit Memo”.

The field will be passed on and made visible on

  • Page 20 “G/L Entries” and
  • Page 25 “Cust. Ledger Entries”

when we drill down on different tables exposed via Navigate action on the posted document.

At this moment, delta files for reports (standard report modifications) cannot be part of an extension. Please visit Extension Packages Capability Support Matrix for updates on this topic.

Therefore my attempt to modify the report 1306 to add the new field in the layout and report failed:

ext21

Delivering modifications to reports must be done in a different way. One alternative is to add a new action on the Posted Sales Invoice and point to a copy of report 1306 (modified to include our field). Therefore our custom code won’t be extension-only based.

This link contains a fob with all the modifications done to a Demo Database 2017 CU9.

The steps to create and publish the extension are very similar to the steps in my previous blog located here.

Let’s test the changes by pointing our Service tier to the target database and publish there the new extension.

First let’s install the extension, by opening page 2500 “Extension Management”:

ext22

Let’s open Sales Invoice page and create a new invoice. The “Created By” field should be in the first FastTab and auto-populated with the logged in user:

ext23

After posting the invoice we notice that the new field is part of the “Posted Sales Invoice” as well:

ext24

Next we want to check the existence of this new field in page “General Ledger Entries” and page “Cust. Ledger Entries”. In the “Posted Sales Invoice” page, in the Actions tab, click on Navigate, and check the 2 pages:

Ext25

ext26

At the core of this simple exercise is the codeunit 50000 in which I subscribed in a few instances to standard events like OnAfterInsertEvent:

 ext28

Thank you for reading, sharing, commenting, liking, following 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s