Subscribe via RSS Feed Connect on LinkedIn

Dynamics NAV 2013R2 Development #2

21st September 2014 0 Comments

Introduction

Following up from my first post Dynamics NAV 2013R2 Development #1 I would like to add flesh to the bones for Solution 2 this involves adding new objects and code to Dynamics NAV 2013R2.

Since the release of 2009 with the RTC pages we can work differently, looking at the Customer table and possibly some fields that are often added, “ANA No.”, “Mobile No.”, “Accounts Contact No.”, “Delivery Instruction 1”, “Delivery Instruction 2”, “Created by User”, “Created Date Time”, Etc:, Solution 1 is quicker and would only modify two objects the Customer table and Customer Card page, in the short term this might seem a better option.

Considering that due to expansion the end client wants to roll out the changes to other localized database the changes to the table and card cannot just be imported and replaced, whatever is done now to the standard objects would need to be done in each database, the table changes additional fields and validation code, page changes to add any additional fields and sections.

The localized databases are to be installed in partnership with a local Dynamics NAV partner who will also deal with training, object language localisation, migration and roll out, therefore it is a benefit to minimise the partners involvement and reduce costs, you will see that the Customer Table and Customer Card changes are minimal making it easy to roll out changes, upgrade and merge the objects into a new database.

 

post_20

Table 50000 Extended Customer

A design document has identified a number of fields the end client would like available on the Customer Card, several fields to help the Accounts Receivables department with contact information for the Customers accounts contact, also fields for ANA Code and delivery instructions, a new table 50000 Extended Customer is created to add these fields with scope to add new fields at a later date.

post_21

 

Adding a lookup to the Contacts table to allow for both manual or automatic population of the other contact fields.

post_23

 

As there is no “Created by User” on the Customer table two fields will be populated on the extended customer table.

post_22

 

Page 50000 Extended Customer

The Customer Card will be modified adding a “Page Part” to display the fields from the Extended Customer table, page 50000 Extended Customer is created and the fields added.

post_210

 

Codeunit 50000 Extended Customer Mgmt.

A new codeunit will deal with automatically creating, renaming and deleting the Extended Customer table when the Customer record is updated, using a variable of the table.

This function will Insert an Extended Customer Record

post_24

This function will Delete an Extended Customer Record

post_25

This function will rename an Extended Customer Record

post_26

This function will return a true or false if an Extended Customer Record exists

post_27

This function will Get an Extended Customer Record, if no record exists it will create one.

post_28

This function will update an Extended Customer Record if it has changed, to be used with a record variable.

post_29

 

Table 18 Customer

The work on the Customer table is minimal, all that is required is three trigger calls, a variable ExtCustMgmt type codeunit 50000 is used.

A call to the codeunit variable is added in the On Insert trigger code

post_211

A call to the codeunit variable is added in the On Delete trigger code

post_212

A call to the codeunit variable is added in the On Rename trigger code

post_213

 

Form 18 Customer Card

The work on the Customer form is also minimal, all that is required is the addition of the Page 50000 Extended Customer as a Page Part linked on the “No.” Field, in this example the Page Part is Captioned as Additional Information

post_214

 

The additional Information fits on the page and can be updated and displayed like any other section.

post_215

Leave a Reply

You must be logged in to post a comment.