Tag Archives: JavaScript

Capturing unhandled errors in JavaScript Control Add-ins

Not that I am saying it’s a good thing, but trial and error is a fairly common approach to debugging in the NAV world. We’ve all done it. Heck, even with the comprehensive testability framework built in, we all still do it more often than we’re happy to admit while sober.

But the overlord of trial and error in NAV is development of control add-ins in JavaScript. JavaScript itself is making it difficult in the first place, and then integration with NAV makes it even harder.

There is one situation in particular that’s adding a cherry on top of all of problems, and it’s the creepy “A script error has occurred” error message. It’s the equivalent of the BSoD.

Continue reading Capturing unhandled errors in JavaScript Control Add-ins

Deploy your resource automatically from Visual Studio

In most of my JavaScript client extensibility demos, I develop the whole content of my resource ZIP files inside Visual Studio. When I press F6, magically my NAV gets updated with the latest version of JavaScript that I just wrote. So, how do I do that?

Here’s the cookbook.

Continue reading Deploy your resource automatically from Visual Studio

Client Extensibility Demos

On Monday, June 15th I have delivered another session in Microsoft’s Road to Repeatability series of online demos about technical NAV features, this time covering Client Extensibility. The session went through both the .NET and JavaScript aspects of client extensibility, and again – I promised to post all of the demos and content from the session on my blog.

So, here it is, given as-is, with no guarantees or strings attached, just the plain content for you to see if you can make any sense out of it.

Now my to-do list has grown quite big with the stuff that I want to blog, and it includes presenting and explaining most of the concepts I showed in my presentation. So, keep your fingers crossed that I find just enough time to blog about all those small things that have found their way into my presentation, but never into real blog posts that take them inside out and explain in-depth what they are and how really they work.

Of course, you are still free to use any of this in any real, or unreal life scenarios.

Control Add-ins and Version Compatibility

(Update, 20.4.2015: As it turns out – this post is not entirely accurate, as pointed out by Johannes Sebastian. Please read the next post to learn more about which parts are, and which aren’t correct.)

Control Add-ins written in C# are not cross-version compatible. You cannot use an assembly compiled for 2013 R2 with 2015 (or the opposite way around, or any other version combination for that matter) without recompiling it with correct extensibility framework assembly reference.

Control Add-ins written in JavaScript don’t have to be recompiled, are mostly interchangeable, and are (so far) guaranteed to be forward compatible. You can always use a version built for 2013 R2 in 2015. You can use a version built for 2015 in 2013 R2, but the opposite way around is only true if you don’t use any of the new JavaScript extensibility features not supported in earlier versions.

Overloading Methods With JavaScript Control Add-ins

Switching from C# to JavaScript to develop your control add-ins might get you scratching your head more often that your scalp, or nails for that matter, might be happy with.

One of those is overloading. In C#, this is a no-brainer:

However, when you want to do that in JavaScript, if you are not a JavaScript developer, making this work is not as straightforward as a regular JavaScript Joe would find it.

Continue reading Overloading Methods With JavaScript Control Add-ins