Getting the exception type from the GETLASTERROROBJECT

  • Post comments:4 Comments
  • Reading time:6 mins read

In my last post I have introduced the GETLASTERROROBJECT function that returns you the instance of the System.Exception class, representing the actual exception that has happened.

To properly handle exceptions in an unambiguous way, you must use the exception type, not its name, so it is important to get the actual System.Type representing the exception type.

Sounds easy, but it’s not quite so.

(more…)

Continue ReadingGetting the exception type from the GETLASTERROROBJECT

Better error handling in NAV 2015

  • Post comments:5 Comments
  • Reading time:5 mins read

You may love C/AL as a language, but there is an area in it that you must just hate. It’s the error handling. Plainly put, and being actually quite positive about it, in NAV, error handling just sucks. If an error happens, it happens. You have only one possibility to actually capture the error, and it’s the IF CODEUNIT.RUN construct, and it’s limited because you can do it only once per transaction, and if you want to do it twice, you must COMMIT your transaction first.

But still, capturing an error is one thing; actually handling it is quite a different thing altogether.

(more…)

Continue ReadingBetter error handling in NAV 2015
Read more about the article Directions EMEA 2014 content
Poznan

Directions EMEA 2014 content

  • Post comments:28 Comments
  • Reading time:2 mins read

One more great Directions EMEA event is over, and it was a great experience again. I am a bit sorry, though, that my main focus was delivering presentations, so I enjoyed myself less mingling around, meeting new folks and consuming content. But it was still a great event.

What I liked a lot is the audience participation and the interest – all sessions, at least those that I attended or delivered, were packed full. It was a real pleasure presenting and demoing tips and tricks in my “Spicing up your user interface” session, and ranting about barriers and gaps between consultants and developers in my “Breaking the barriers” session. Thank you all who attended and I hope it was worth your time.

(more…)

Continue ReadingDirections EMEA 2014 content

NavUserAccountHelper class

  • Post comments:4 Comments
  • Reading time:5 mins read

Even though my blog queue has a lot of far more interesting todo entries waiting for their prime time, on my short flight to the Directions EMEA conference in Poznań, instead of dozing away or blank-staring through the window, I’ve decided to introduce the Microsoft.Dynamics.Nav.NavUserAccount.NavUserAccountHelper class, a part of the built-in .NET stack of Microsoft Dynamics NAV since the version 2013 R2. My friend, Eric, asked me to blog about it, so here it is, this post is for you, Eric.

(more…)

Continue ReadingNavUserAccountHelper class

Three Whys about .NET Interoperability

  • Post comments:10 Comments
  • Reading time:9 mins read

Once upon a time, a smart bloke named Saikichi Toyoda came up with a 5 Whys troubleshooting technique. It postulates that you only need to ask “why” five times to get to the root cause of any problem in a cause-and-effect sequence.

However, with .NET Interoperability in Microsoft Dynamics NAV (pick your version here), I’ve only had to ask “why” three times today, and unfortunately I could not get to the root cause, except – poor design decisions.

It all has to do with a simple .NET class: System.DBNull. The first “why” is simple: why is there no support for fields on .NET types. The second “why” is even simpler: why don’t we have a null constant in C/AL. And the last “why” downright falls into the “what the heck” category: why did somebody think it was a smart idea to replace DBNull value with null.

(more…)

Continue ReadingThree Whys about .NET Interoperability