Stepping through the code line-by-line or function-by-function can take forever. Luckily, there is an easy way to tell the debugger to stop right where we want it to.
OnRun
trigger:ChangeCustomerName(Text001);
OnRun
trigger:VALIDATE("Post Code");
While running the debugger on this codeunit, it should stop on the Customer.VALIDATE ("Post Code")
line of code. This is because we have set a breakpoint here, which was the filled red circle at the left of that line. The debugger stops right where we tell it to, that is, right before that line of code executes. There is another mark; it is a red circle that is not filled. This is used to mark old breakpoints that we are not currently using. This is useful when we are trying to debug large amounts of code and want to temporarily remove a breakpoint or remember where we had one.
The debugger is not perfect by any means. Some might even say it has a mind of its own sometimes. It doesn't always stop exactly where you want it to. It is a common practice to set a breakpoint on a few successive lines of code in order to ensure that you stop in the general area.
The NAV 2013 debugger is pretty advanced as compared to the old versions. It provides some nice options related to breakpoints.
By selecting the Toggle action, we can add or remove breakpoints while debugging:
The Breakpoints action will provide the list of all breakpoints and options to enable or disable them:
The following three options are provided under the Break Rules action:
INSERT
, MODIFY
, MODIFYALL
, DELETE
, and DELETEALL
, this option will break the execution before the change happens.1
is the base set of functions for NAV, which is used in almost all actions/executions. This option will skip the codeunit 1
from the debugger.The following screenshot shows the options in the Break Rules action:
3.17.29.48