Debugging Dynamics NAV Javascript Control Add-Ins

… or Debugging Dynamics NAV “Any Client Control Add-Ins” as Microsoft seem to be calling them.

Debugging the Windows Client Control Add-ins is relatively easy using the Attach to Process feature of Visual Studio as described way back in 2009 by Christian. It is possible to sort-of do the same with Javascript Control Add-ins but once the Javascript files are actually running they have a different name so breakpoints don’t work as expected.

Below is an easier method which means you can control the debugger from the NAV end. In your Control Add interface class put the following function:

void StartDebugger();

In your Javascript file put this function:

function StartDebugger() {

Then from NAV you can call this:


That’s it. When the Javascript debugger function is hit it will ask you which Script Debugger you want to use and load the correct file so you can set your breakpoints. If you need to set breakpoints in other Javascript files just add a function to them (making sure they have a unique function name)…

function Script2LoadtoDebugger() {
    return true;

…then change then function in your main Javascript to call them and when the debugger starts you can Step-into that function to load the other file.

function StartDebugger() {

Hope this is helpful 😀



2 thoughts on “Debugging Dynamics NAV Javascript Control Add-Ins

  1. Thanks for this! It was helpful. Btw, do you have an idea of how to get rid of the “To help protect your security….” warning when starting the javascript control add in?


    1. I haven’t had any issues with this, I did a quick search and found your post where you mention it’s just when you run on the server?

      Look at this thread which says the two approaches are basically to “allow” the blocked content (which I think you have tried)
      or alternatively try and mark the content so it is not blocked.

      If it is only an issue when running on the server, then it might be to do with where NAV publishes the Javascript files and your permissions on these locations – if you open your browser debugging you should be able to see the addresses. But I’m just guessing, sorry I can’t help more.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s