Custom layout crashes NAV after upgrade

Currently I’m upgrading a customer from NAV2015 to NAV2017.
During the implementation of NAV2015 the customer has asked me, I they could design there reports themselfs.

And my reflection was, why not.

So as said the customer changed there report layout within NAV with the feature “Custom Layouts”.
A new feature back in NAV2015 but still available in NAV2017.

Now during the upgrade of this customer I ran into some issues when testing the upgraded version.
Every time I try to print a report with a custom layout NAV crashes with no more information.

Continue reading  

Field Rename will break Event Triggers

Events are well known in the NAV world today. Everybody is using this very nice feature. Not!?
No more table modifications for validations or extra features when inserting records. Only but advantages from my opinion. But recently I ran into an issue.

I have created a new table with some fields.
Then I created a hook codeunit with 2 functions based on the “OnAfterValidateEvent” trigger.
Nothing special.

After everything was tested, the consultant or customer asked me to change the name of some fields. Not just the captions but also the name.
So as ask, I did the changes and compiled everything without an error. Where the fields were used on pages or in CAL everything was updated with the new field name. And it seems that it would work.

But after testing the solution again we ran into some issues. The validations of the fields were gone and no triggers were fired.
And after some investigation I found the problem in the “Event Subscription” page.

Continue reading  

Change default printer from CAL

A while ago Waldo has posted a way to print any document from CAL. Here he showed us how easy it is to print any document with any extension by simple using .NET.
Recently I used this to print merged PDF’s from CAL, but I ran into an issue.

I want to print this PDF’s on a certain printer.
Some products like Adobe cleams to support this by passing some parameters like:

AcroRd32.exe /t path “printername” “drivername” “portname”

But then you are related to specific software and what with the other extensions.
Do you realy want to create separate statements for every extension.
I don’t think so.

Thereby I search for a better way, and here it is.
Why don’t use .NET again to solve this issue.
Instead of passing the printer as a parameter, I will switch my default printer from CAL.

Continue reading  

Avoid Factbox records on Empty pages

Factboxes are more then ever a powerfull way for presenting related information. Normally you link your Factbox through properties, but now and then you need to do this from code.

This works fine if your page has at least one record, because the filtering is set on the “OnAfterCurrRecord” trigger of the page. So when there is no records, no filter is set on you factbox and then all related records are shown. Continue reading  

Get Source Table from Page

Codeunit 700 Page Management is a Codeunit that I use once in a while. It has functions to get the Default Lookup Page or the Card Page of a certain table.
It also contains functions to open a Page by only passing a Table ID or a Record. You can run it default or modal and even open a page with an autofocus on a certain table field if you like.

All these functions are very handy, but I only miss one.

In my solution I need to get the table of a certain Page ID. So the opposite way of the existing functions.
By looking to the existing functions you will see that there’s a way. Most of the functions are using a system table called “Table Metadata”, were you can easy find the “Lookup Page”.

But the function “GetDefaultCardPageID” also uses the table “Page Metadata”.
So lets take a closer look to this table.

Continue reading