Author Archives: Soren Klemmensen

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.

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.

Source Code Management: Evil, a waste of time, too much work or something much better?

A great chalk talk (CT103 – Useful Tools for Getting the Most Out of NAV) with Waldo at Directions in Phoenix was my inspiration for this. I ended up high jacking part of Waldo’s session (so sorry Eric. I will try to restrain myself next time), because I could see so many possibilities for our community. After the session I had a great hall chat with Eric (Waldo) Wauters, Mark Brummel and Gary Winter (all 3 of them behind the Partner Ready Software initiative), sharing some of the things I have learned over the years of using source control.

The inspiration for this blog post came from this discussion.

So what is source code control and what benefits among others does it bring us:
· Source Code Control
· Product Management
· Code Review
· Branching strategies and Code Management

Let me go through each one and talk about the benefits.

Source Code Control is the obvious one. This is what everybody is thinking about when they think Source Code Control. We know what code was change, who did the change and when it was done. If this is all you are considering Source Code Control to be you need to keep reading. While it is all nice things they really don’t bring much value to the table. We are missing the most important information. Why was it changed? The “why” is the “Work Item” that caused this development to be done. The “Work Item” can be a Bug, a Task, an Issue, and so on. You properly have some kind of naming in your organization. If your Source Code Control system doesn’t track the reasons why we are making the changes it is only half implemented.

That brings me to Produce Management. Source Code Control is about securing your intellectual property, but if you only secure the code and not the understanding and reasoning of the code all you have is code and not intellectual property. Product management is about securing that you are doing the right things for your product for the right reasons.

Code Review. Sounds borrowing and might sound like you want to hit your developers with all the mistakes they make, but if that is what you are thinking of, you have the complete wrong approach. Code Review and Source Code Control makes it possible not only for the individual developer to review his/hers code before check-in, making sure that it is only the intended code that gets into the system. It also makes it possible for peer review causing the developers to learn tips and tricks from each other creating better and more error free code. This mentor process creates a better and stronger team with the highest class of developers.

Branching strategies: You might think I have gone completely off the deep end now and you will not be the first to think so, but in reality, this is one of the greatest benefits with source control that often is totally over looked. I did not hear anybody even mention it and this is an essential part of why everybody needs source code control. If you are creating releases or hotfixes the right setup is going to help you manage it all and with very little work. It is about being able to manage your code in a total transparent way.

So we have established that Source Code Control has more to offer then just “Source Code Control”. It should be part of every partners approach to development. I know we are all different and some of us develop verticals, others add-on’s and again others are doing purely horizontal project after project.

It doesn’t really matter who you are and what you do. If you are serious about NAV development, Source Code Control should be part of your planning.