Setting breakpoints
Stepping through 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.
How to do it...
Create and save the same codeunit discussed in the Using the debugger recipe in this chapter.
Design the codeunit.
Go to the following line of code in the
OnRun
trigger:ChangeCustomerName(Text001);
Press F9 twice.
Go to the following line of code in the
OnRun
trigger:VALIDATE("Post Code");
Press F9 once.
Your window should look like the following screenshot:
Save and close the codeunit.
From the Tools menu in the NAV client select Debugger | Active (Shift + Ctrl + F11).
Run the codeunit.
How it works...
When running the debugger on this codeunit, it should stop on Customer.VALIDATE("Post Code")
line of code. This is because we have set a breakpoint here, which was the filled-in 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...