NAV TechDays 2014 Pre-conference goodies

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

So, NAV TechDays 2014 have started, again, with the pre-conference sessions that were all sold out and packed full.

Today I had an extraordinary pleasure to teach the advanced .NET Interoperability concepts to 15 people that came from all over the world, from Brazil to Australia. It was an interesting workshop, challenging – I must say (thanks to Rafael who made me improvise a solution to a typical DotNet limitation), and I am looking forward to delivering two more sessions about .NET and Control Add-ins tomorrow, and on Friday.

As promised, I am making the materials from the presentation available for the download, in case you want to learn the same stuff the attendees learned today.

(more…)

Continue ReadingNAV TechDays 2014 Pre-conference goodies

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

Request page automation in NAV 2015

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

Most of What’s New information about NAV 2015 will mostly talk about the Word report layouts, as well as the C/AL support for these. However, most of the What’s New documentation doesn’t have a single word about what I find among the most exciting new reporting features in C/AL: the capability to programmatically control the request pages.

(more…)

Continue ReadingRequest page automation in NAV 2015

DotNet Quick Tip: Accessing members with invalid names

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

A friend asked my by e-mail today about a problem he encountered with DotNet interop: how to access a property of an object, if the property name matches a reserved word in NAV. A simplest example is from the Microsoft.Dynamics.Nav.SMTP.SmtpMessage class that comes bundled with NAV 2013.

Consider this piece of code:

Mail := Mail.SmtpMessage;
Mail.To := 'john.doe@noname.no';

If you try to compile this, it will fail. It’s simple: the To property name is invalid in the C/AL context, because it is a reserved word.

So, how do you fix it?

(more…)

Continue ReadingDotNet Quick Tip: Accessing members with invalid names

.NET Tips & Tricks: Mediator Pattern (on steroids)

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

When I was writing my last post I had a distinct feeling that I was trampling over some boundaries of good NAV design. After all, you should not do stuff like that, NAV isn’t meant to do things like that, or at least that was how I felt.

And then two things happened.

First, I asked myself: what the heck, why not? What exactly is NAV meant to do, and why not things like that? If folks at Vedbæk didn’t provide an out-of-the-box solution for the problem, why should the problem stay unsolved?

Second, my dear friend and a fellow MVP, Hrvoje of Hudo’s Vibe, identified the thing as the mediator pattern. So, the thing I’ve done to NAV, civilized world has been doing to their programming environments for a long time.

And then I decided to take it all to a different level altogether, and expand the simple class which didn’t do much but raise events on itself when its method was called, into a full-scale framework. And here it is, the mediator pattern incarnated into a brand new Dispatcher class, adapted to NAV, and with features that make it truly flexible. I do not dare starting to think what are all the situations where you could put this thing to use in NAV.

Read on.

(more…)

Continue Reading.NET Tips & Tricks: Mediator Pattern (on steroids)