Use references to break compile dependencies

I was looking into a customer App yesterday. That app had a dependency defined in app.json.

I wanted to look at the real requirements for this dependency. I found 1 (one) place in my code where this dependent App was used.

dataitem(PageLoop; "Integer")
{
    DataItemTableView = SORTING (Number) WHERE (Number = CONST (1));
    column(Phone_No_Cust; Cust."Phone No.")
    {
    }
    column(Registration_No_Cust; Cust."ADV Registration No.")
    {
    }
    column(CompanyInfo_Picture; CompanyInfo.Picture)
    {
    }

In Iceland we add a field to the Customer table (Cust.”ADV Registration No.”). Every business entity in Iceland has a registration number. A company only has one registration number but can have multiple VAT numbers. We already have that registration number field in the Company Information record, but we also add it to Customer, Vendor and Contact records. The Employee social security number equals to the registration number for an individual.

To be able to remove the compile dependency, and therefore the installation dependency I did the following:

Removed the dependency App from app.json

Added a variable to the report

    var
        ADVRegistrationNo: Text;

Changed the data set configuration to use this variable

dataitem(PageLoop; "Integer")
	{
	    DataItemTableView = SORTING (Number) WHERE (Number = CONST (1));
	    column(Phone_No_Cust; Cust."Phone No.")
	    {
	    }
	    column(Registration_No_Cust; ADVRegistrationNo)
	    {
	    }
	    column(CompanyInfo_Picture; CompanyInfo.Picture)
	    {
	    }

Located the code that fetches the Customer record and added the reference way to get the required data

trigger OnAfterGetRecord()
var
    DataTypeMgt: Codeunit "Data Type Management";
    RecRef: RecordRef;
    FldRef: FieldRef;
begin
    Cust.Get("Ship-to Customer No.");
    RecRef.GetTable(Cust);
    if DataTypeMgt.FindFieldByName(RecRef, FldRef, 'ADV Registration No.') then
        ADVRegistrationNo := FldRef.Value();
end;

There are both positive and negative repercussion of these changes.

The positive is that we can now install, uninstall both apps without worrying about the compile dependency.

The negative is that breaking changes to the dependent App does not break the installation of this customer App.

So, what happens if the dependent App is not installed? The FindFieldByName will return false and the variable will be blank text.

Since we have adapted the policy that Microsoft uses; no breaking table changes, this field should just be there.

If the data is required and will break the functionality if not present we can change the code to something like this.


Cust.Get("Ship-to Customer No.");
RecRef.GetTable(Cust);
if DataTypeMgt.FindFieldByName(RecRef, FldRef, 'ADV Registration No.') then
    ADVRegistrationNo := FldRef.Value()
else
    Error('Please install the Advania IS Localization App into this Tenant!')

Arion Banki currency importer

It is not often that I post a solution that is intended to be used in Iceland only.  Here is one.

Arion Banki is one of the major national banks in Iceland and they want to support Dynamics NAV users.  On their website you will find the currency exchange rates for every working date.  I created an importer that will download the exchange rate from their website and import into NAV.

There are two ways to do this.  First is to go into Currencies in the NAV Client and click on Import

ArionBankiImportCurrency

The other way is to add a Job Queue Entry to make this an automatic task.

NewJobQueueEntry

The process will find the last date imported into your system and import all days from and including that date to the current working date.

CurrencyImportNAV2009 CurrencyImporterObjects2013R2

 

 

NAV 2013 R2 is available for download in 20 localized versions

Last Monday Microsoft announced the release of a new major version of Dynamics NAV.

On the product download page I am happy to see that my IS localized version is available.  It is nice to see that and a big change from the last release where the IS version was not available until May 1st this year, seven months after the global release date.

NAV2013R2_IS

A PDF document is supplied with highlighted new features and download links for all versions.

Microsoft Dynamics NAV 2013 R2 download links
AU-Australia Download
AT-Austria Download
BE-Belgium Download
CA-Canada Download
DK-Denmark Download
FI-Finland Download
FR-France Download
DE-Germany Download
IS – Iceland Download
IN-India Download
IT-Italy Download
MX-Mexico Download
NL-Netherlands Download
NZ-New Zealand Download
NO-Norway Download
ES-Spain Download
SE-Sweden Download
CH-Switzerland Download
GB-Great Britain Download
US-United States Download
W1 Download

Old format or invalid type library Excel error in Rapid Start

As a part of the new localized NAV 2013 we need to configure the Rapid Start package to be used with new installations.  As we started to work with the packages trying to export to Excel we got an error.

ExcelLocalizationError

The cause is known by Microsoft.

You receive this error calling an Excel method when the   following conditions are true:   

  • The method requires an LCID (locale identifier).
  • You run an English version of Excel. However, the regional settings for the computer are configured for a non-English language.

If the client computer runs the English version of Excel and the locale for the current user is configured for a language other   than English, Excel will try to locate the language pack for the configured   language. If the language pack is not found, the error is reported.

We saw the same error in NAV 2009 R2 Role Tailored Client.  The solution is simple, download and install a language pack for Microsoft Office that matches your regional settings.  You should find the language pack on the Office Language Interface Pack (LIP) downloads page.

Link for Office 2016

 

When the Database Name has non-english character

At a client I was trying to start the NAV 2009 R2 Service Tier.  The client has a non-english character in the database name and the service tier complained and would not start.  This is an issue that Microsoft fixed recently and after I installed a newer version of the service tier everything works fine.

I also had to make sure that the CustomSettings.config file was saved with UTF-8 encoding.  This can be done by running Notepad in administrative mode, open the file and select the UFT-8 encoding in save-as dialog.

Icelandic Localization

In the localized version of Dynamics NAV 2009 R2 the report layout for Role Tailored Client is missing.  I have created the layout and applied a few fixes to the reports.

ID Name Caption
204 Sales – Quote Sala – Tilboð
205 Order Confirmation Pöntunarstaðfesting
206 Sales – Invoice Sala – Reikningur
207 Sales – Credit Memo Sala – Kreditreikningur
210 Blanket Sales Order Standandi sölupöntun
405 Order Pöntun
406 Purchase – Invoice Innkaup – Reikningur
407 Purchase – Credit Memo Innkaup – Kreditreikningur
10911 IRS Details Upplýs. vegna skattstofu
10912 Trial Balance – IRS Number Prófjöfnuður – Skattst.númer
10913 IRS notification Tilkynning skattayfirvalda
10940 VAT Balancing A VSK-afstemming A
10941 VAT Balancing Report VSK

The following ZIP file is encrypted.

NAV IS2009R2 Reports