Category Archives: Uncategorized

Moving to WordPress

So it happened. I moved my blog to WordPress. Not that I did not like Office 365’s public site and all the great options that it gave me. Quite the opposite. The simple fact is that Microsoft is about to retire this option, so I just need to get it done before that happens.

I hope you will continue to enjoy my blog.


Is My Record Temporary (Part 2)?

Back in July I wrote a blog on how to test if Records are temporary or not.

You can read it here.

Microsoft has now added it so you can directly test if a record is temporary or not with out any extra coding.

You define a record and like “Cust” as a variable of Record based on the Customer table. Now you can write things like.


Thanks Microsoft. Great to see you implement my suggestions.


Is My Record Temporary?

Very often when developing we have logic we would like to execute on records, but only when the table is actually a real table and not when used as a temporary record. This could be things like inserting, modifying or deleting attached records in another table which would make no sense in most cases if the table you are currently in is temporary.

Now when we use a RecordRef we have a command that will return true or false based on the RecordRef in question is temporary or not. The command is called


However this command sadly doesn’t exist for Records.

So how can we get around that issue?

I have created a RecordRefLibrary codeunit that contains the following 2 functions among others

IsVariantTemporary(PassedVariant : Variant) : Boolean



Variant2RecRef(PassedVariant : Variant;VAR RecRef : RecordRef)


PassedVariant.ISRECORD :


PassedVariant.ISRECORDREF :

RecRef := PassedVariant;




Now in each table where I need it I add the following function

IsTemporary() : Boolean


Now I can write


anywhere I use the Record and it will return if the record I am currently in is temporary or not.

I could of course also just call directly to the codeunit if I would like not to make changes to the Table, however it would be good practice in my view to expose the functionality on each table where needed, so everybody knows where to find it.

Hopefully this was helpful to some of you if you don’t have a solution for this already.

A couple of “secret” switches in Dynamics NAV

Unless you are very new to Microsoft Dynamics NAV I am sure you know of the General Ledger Setup.

This is where we setup most General Ledger related settings such as Check G/L Account usage, the local Currency Unit (LCY) ,if VAT is in use or if we are using Unrealized Tax.

Many might not be aware that this also has a few hidden settings.

If you run table 98 General Ledger Setup from the Object designer you will see a few more fields then what the users sees in the standard page in your client.

A few that I have found very use full from time to time are:

Field What the helps say
Mark Cr. Memos as Corrections Specifies whether to automatically mark a new credit memo as a corrective entry.


You can use the field if you need to post a corrective entry to a customer account.


If you place a check mark in this field when posting a corrective entry, the program will post a negative debit instead of a credit or a negative credit instead of a debit. The Debit Amount field (or Credit Amount field) on the relevant account will then include both the original entry and the corrective entry, which will have no effect on the debit (or credit) balance.

Amount Decima Places Determines the number of decimal places the program will display (for example, on invoices and in reports) for amounts in $. The default setting, 2:2, specifies that amounts in $ will be shown with two decimal places.
Unit-Amount Decimal Places Determines the number of decimal places the program will display (for example, on invoices and in reports) for sales and purchase prices for items, and for sales prices for resources in $. The default setting, 2:5, specifies that sales and purchase prices in $ will be shown with a minimum of two decimal places and a maximum of five decimal places.
Amount Rounding Precision Specifies the size of the interval to be used when rounding amounts in $.

Amounts will be rounded to the nearest digit.

Unit-Amount Rounding Precision Specifies the size of the interval to be used when rounding unit amounts (that is, item or resource prices per unit) in $.


Use this field to have the program round item prices on invoice lines when you sell to a customer or buy from a vendor in $. The program rounds the amount in the Unit Price field for customers and the Direct Unit Cost field for vendors, on the invoice line. Amounts will be rounded to the nearest digit.

Especially the “Unit-Amount Rounding Precision” have come in great use many times where customers have special rounding requirements on their unit amounts (things like Item Costs, Prices with more).

One setting to rule them all.


Let’s Clean up NAV #13 – Chain Name

Adding to Luc van Vugt little miniseries on his blog about things we can do to clean up NAV here is another one.

Table 18 Customer has a little known field called “Chain Name”. It is field No. 18 and has been in the system “forever”. Well almost…

If I remember right this field has roots as far back as I can remember and I actually use it quite often as customers often request some kind of Chain association to be indicated on the customer card. However the field as it is today has a few issues. First it is not located on any page so kind of hard to use for the end user and secondly it doesn’t have a table, but is free text (or I should say Code as it is a code 10 field).

Now we normally don’t call code fields something ending on “Name”, but that is maybe beside the point in this case.

My suggestion would be one of two:

Either we need to get rid of the field and remove it from the table. Hey that is the easy thing to do.

Alternative we should rename the field to “Chain Code”. Create a Chain Table with associated List Page and setup a table relation. We of course should also add the field to the customer card.

My 10 cent on this one.

Let’s clean up NAV #12 – Next Counting Period

My good friend Luc van Vugt started a little miniseries on his blog with things we can do to clean up NAV. What a great idea, so here is something I have noticed.

In NAV 2015 the Next Counting Period was replaced by 2 date fields after I reported it. The field was used to store the date filter for the next counting period, but if you used counting cycles and had users with different date setting in their regional settings you quickly got quite the mess to figure out. You should of course never store Date filters in text fields unless they are used with in the same transaction ensuring that the user have not changed regional settings in the meantime.

After this was done the Field “Next Counting Period” Text(250) which exist in Table 7380 Field 8, Table 5700 Field 7382 & Table 27 Field 7382 was never removed in 2015. It is not used in the code or in the UI to my knowledge, so maybe it is time to clear it up and get rid of it permanently.

Should there be a need to display the date filter we can always display it based on the 2 new date fields by calculating it on the fly which would ensure it is consistent with the uses current regional settings.

It is a low impact issue as the field has no use today and it is easy to fix not to mention it reduces record length of a tables considerable.