Fixing Preview Posting: Part 2

  • Reading time:11 mins read

In my two last posts, I laid out the technical design of the Preview Posting feature, and then showed how to simplify its design to get around the unwanted behavior of TryFunction.

One thing is obvious from these posts: Preview Posting wants to simulate posting of a document (or journal) to show what the results would be, but without leaving any actual trace in the database. In database lingo – we want the transaction to be rolled back.

Rolling back is no brainer. Simply throw an error, or do a silent abort, Except if there is COMMIT. In that case, no rolling back helps.

I have announced earlier that my today’s post will be about how to nest transactions in C/AL so that an inner COMMIT has no effect on the transaction as a whole, which can still be successfully rolled back.

That’s what this post is about.

Continue ReadingFixing Preview Posting: Part 2

Fixing Preview Posting: Part 1

  • Reading time:4 mins read

In my yesterday’s article about the Preview Posting feature in Microsoft Dynamics NAV 2016 I said there are at least two ways to redesign it to avoid both the unnecessary complication and inherent dangers of the TryFunction feature behavior.

In my first post, I’ll show that it would have been perfectly possible to achieve exactly the same functionality without try functions. And it would take a total of one new line of code, one changed line of code, and six removed lines of code.

Let’s go and simplify it.

Continue ReadingFixing Preview Posting: Part 1

TryFunction Lessons Learned from Preview Posting

  • Reading time:8 mins read

One of great new functional features of Microsoft Dynamics NAV 2016 is preview posting. It allows you to preview all the entries that would result from posting a document or a general journal.

Preview posting is not a simple thing. If it was, Microsoft would have delivered it years ago. There must be something in particular with NAV 2016 that powers preview posting, so I decided to investigate it and see exactly how it works.

I am not particularly happy with what I found out, but I have also learned some valuable lessons from it. In this post, I’ll share my findings.

Continue ReadingTryFunction Lessons Learned from Preview Posting

What’s New in NAV 2016: Record Type Improvements

  • Reading time:4 mins read

We all use records. And we all used to whine about records not supporting all the features we need. And they still don’t, but in Microsoft Dynamics NAV they support much more.

Some of the new features are well documented, some are somewhat documented. So here’s what I figured out so far is new about the Record data type.

Continue ReadingWhat’s New in NAV 2016: Record Type Improvements

What’s New in NAV 2016: Control Add-ins

  • Reading time:4 mins read

Well, control add-ins are not new in NAV 2016, they have been around for a long time now. But, they have been improved and this blog post is about these improvements.

Of course, the improvements are exclusively in the Web client framework, not the Windows client, and I am educated-guessing here that we won’t really see many improvements in the control add-in framework for Windows in the future. Why would we? All control add-ins should target all clients and use the Web framework, anyway so the case for Windows client is getting weaker and weaker.

Continue ReadingWhat’s New in NAV 2016: Control Add-ins

What’s New in NAV 2016: Splitting Atoms with TryFunction

  • Reading time:11 mins read

If this was a joke, then it would be one of those good-news-bad-news jokes. So which one do you want first? To stay true to all jokes of this kind, I’ll start with good news first.

Good news is, you now have TryFunctions, that return true if no error happens, and false if an error happens inside them.

And the bad news? You’ll never want to use them.

Continue ReadingWhat’s New in NAV 2016: Splitting Atoms with TryFunction

What’s New in NAV 2016: Application Test Toolkit

  • Reading time:3 mins read

The best news sometimes go silent, and the newest release of Microsoft Dynamics NAV has just proven this claim.

Ladies and gentlemen, Microsoft Dynamics NAV 2016 comes shipped with full set of application test toolkit, that you can use to test your customizations against regression issues. Even though most partners out there have never even tried the testability features, let alone written a unit test (for all the wrong reasons), testability framework of NAV is one of its strongest points, and was the last missing piece to complete the big puzzle called Road to Repeatability.

Continue ReadingWhat’s New in NAV 2016: Application Test Toolkit

Comparing .NET values

  • Reading time:1 min read

When comparing .NET variables, including Enums, you cannot use C/AL comparison operators. To compare .NET variables, you must use the Equals method (of the System.Object type) that all .NET types implement or inherit. So, instead of IF var1 = var2, or IF var1 = var1.EnumValue (in case of an Enum), just write IF var1.Equals(var2), or IF var1.Equals(var1.EnumValue).

I see this mistake often being made or attempted by developers, even though it has been documented inside .NET Interoperability documentation since it was introduced with 2009 R2.

Continue ReadingComparing .NET values

Directions EMEA 2015 Session Content

  • Reading time:2 mins read

For me, Mannheim was always a yet another German city, one that beyond its name I knew nothing else about. When it was announced that Directions EMEA 2015 would be in Mannheim, my first reaction was “say what?” And yet, just as last year in Poznan, I was pleasantly surprised, and realized that every place has something to show, spirit to share, and energy to bring.

There are very few conferences that matter to me. One of them is Directions EMEA, and this year it’s the fourth time that I got a chance to speak and share my ideas and hacks with the community. As promised, and in line with my never-broken tradition, I’m publishing all my content on my blog for you to download.

Continue ReadingDirections EMEA 2015 Session Content

What’s New in NAV 2016: Code Editor

  • Reading time:4 mins read

Three years ago I was doing a presentation about something or other about NAV at a non-NAV conference. That’s in front of normal developers. And you can imagine what their impression was of the state of the technology when, in front of a couple of hundred mostly C# developer, I opened the C/AL editor.

I don’t need to be concerned about that anymore, because Microsoft Dynamics NAV 2016 comes with a new code editor, which comes with a number of features the whole NAV community way hoping for since I remember. And I started forgetting a long time ago.

Namely, we now have:

  • Proper syntax highlighting
  • Line numbers
  • Change indicators
  • Auto-complete intellisense style. Ish.
  • Syntax tooltips
  • And – hold your seats! – undo!
Continue ReadingWhat’s New in NAV 2016: Code Editor