Using the debugger
This recipe will show you how to use the debugger to examine the code that is currently executing. We will demonstrate how to go through the code line-by-line and watch how values and objects change.
How to do it...
Create a new codeunit from Object Designer.
Add the following global variable:
Name
Type
Subtype
Customer
Record
Customer
Add the following global text constant:
Name
ConstValue
Text001
Matt Traxinger
Add a global function called
ChangeCustomerName
.The function should take in the following parameter:
Name
Type
Length
NewName
Text
50
Add the following code to the function:
Customer.Name := NewName;
Add the following code to the
OnRun
trigger:Customer.FINDFIRST; ChangeCustomerName(Text001); Customer.VALIDATE("Post Code");
Save and close the codeunit.
From the Tools menu in the NAV client select Debugger | Active (Shift + Ctrl + F11).
From the Tools menu in the NAV client select Debugger | Breakpoint on Triggers (Shift + Ctrl + F12).
Run the codeunit...